AdvancedRating 1900
No Two Equal Neighbouring Digits
Count the integers from 1 to n in which no two neighbouring digits are equal (like 121 or 9, but not 1223).
Input
One integer n (1 ≤ n ≤ 10¹⁸).
Output
One integer.
Sample 1
Input
10
Output
10
Sample 2
Input
11
Output
10
Output appears here