CSES - Removing Digits II
  • Time limit: 1.00 s
  • Memory limit: 512 MB

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

How many steps are required to make the number equal to 00?

Input

The only input line has an integer nn.

Output

Print one integer: the minimum number of steps.

Constraints

  • 1n10181 \le n \le 10^{18}

Example

Input:

27

Output:

5

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