n = input() s = len(n) + 1 print(9 * s)