Тавсифи масъала
A palindrome is a number whose digits read the same from left to right and from right to left. Examples: , , .
Palindrome checking is done as follows. Let the number have length . Compare the first digits with the last digits in pairs:
- 1st digit last digit,
- 2nd digit second last digit,
- 3rd digit third last digit,
- and so on.
Each such comparison is called a pair. If all pairs are equal, the number is a palindrome.
Almost palindrome
A number is called almost palindrome if, among all these pairs:
- exactly one pair has different digits (exactly 1 mismatching pair),
- all other pairs match.
So, palindromes themselves (with mismatching pairs) are not almost palindromes.
Given an integer , count how many almost palindrome numbers are in the range from to .
Input Format
One integer ().
Output Format
Print one integer --- the number of almost palindrome integers in .
Scoring
| Subtask | Constraints | Points |
|---|---|---|
| 1 | 17 | |
| 2 |
Мисолҳо
15
5
In , the almost palindromes are: , , , , . There are such numbers.