count=0
for i in range(1,2020):
    str1=str(i)
    if '9'in str1:
        count += 1
print(count)