N = input() L = len(N) print(9*L + 9)