#t97. 优美的数字
优美的数字
Beautiful Numbers
Problem Description
If all the digits of a positive integer are the same in decimal, Little A thinks the positive integer is beautiful. For example, every digit of is , so is beautiful. Every digit of is , so is beautiful. The digits of are not all the same, so is not beautiful.
Little A wants to know how many beautiful positive integers do not exceed . Can you count them for him?
Input Format
One line containing one positive integer .
Output Format
One line containing one positive integer: the number of beautiful positive integers not exceeding .
Sample Input
Sample Input 1
6
Sample Input 2
2025
Sample Output
Sample Output 1
6
Sample Output 2
28
Sample Explanation
For the first sample, . The positive integers not exceeding are . All of them are single-digit numbers with identical digits, so they are all beautiful. Therefore there are beautiful numbers in total, and the output is .
Constraints
For all test cases, .