n = int(input())
c = 0
for i in range(10, n + 1):
s = i // 10 % 10
g = i // 1 % 10
if s == 0 or g == 0:
c += 1
print(c)
/**************************************************************
Problem: 1750
User: admin
Language: Python
Result: Accepted
Time:122 ms
Memory:34244 kb
****************************************************************/