a=int(input("")) def count_ones(a): return ''.join(str(i) for i in range(1, a+1)).count('1') print(count_ones(a))