#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 66 is 66, so 66 is beautiful. Every digit of 9999 is 99, so 9999 is beautiful. The digits of 123123 are not all the same, so 123123 is not beautiful.

Little A wants to know how many beautiful positive integers do not exceed nn. Can you count them for him?

Input Format

One line containing one positive integer nn.

Output Format

One line containing one positive integer: the number of beautiful positive integers not exceeding nn.

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, n=6n = 6. The positive integers not exceeding 66 are 1,2,3,4,5,61, 2, 3, 4, 5, 6. All of them are single-digit numbers with identical digits, so they are all beautiful. Therefore there are 66 beautiful numbers in total, and the output is 66.

Constraints

For all test cases, 1≤n≤20251 \le n \le 2025.