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