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

print(n)