题目描述

Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.

Constraints
1≤N≤1016
N is an integer.

输入

Input is given from Standard Input in the following format:

N

输出

Print the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.

样例输入 Copy
100
样例输出 Copy
18
提示

For example, the sum of the digits in 99 is 18, which turns out to be the maximum value.

03-26 00:27