Code Submission Evaluation System Login

CSES Problem Set

Removing Digits


Task | Statistics


CSES - Removing DigitsCSES - Removing Digits

Time limit:1.00 s Memory limit:512 MB

You are given an integer $n$. On each step, you may substract from it any one-digit number that appears in it.

How many steps are required to make the number equal to $0$?

Input

The only input line has an integer $n$.

Output

Print one integer: the minimum number of steps.

Constraints
Example

Input:
27

Output:
5

Explanation: An optimal solution is $27 \rightarrow 20 \rightarrow 18 \rightarrow 10 \rightarrow 9 \rightarrow 0$.