N = 入力() print(len(N) * 9 + 9)