#K11756. Add Persistence

    ID: 23539 Type: Default 1000ms 256MiB

Add Persistence

Add Persistence

You are given a non-negative integer n. The add persistence of n is defined as the number of times you must replace the number by the sum of its digits until the result has only one digit.

For example, if n = 999, then 9 + 9 + 9 = 27, and then 2 + 7 = 9, so the add persistence is 2.

Your task is to compute this number. All input will be a single non-negative integer provided through standard input. Your output should be a single integer denoting the number of steps required.

The process can be mathematically expressed as follows: \[ \text{Let } n_0 = n, \quad n_{i+1} = \sum_{d\in\text{digits}(n_i)} d \quad (i \ge 0), \]

Find the smallest k such that nk is a single digit.

inputFormat

The input consists of a single line containing one non-negative integer n read from standard input (stdin).

outputFormat

Output a single integer to standard output (stdout) representing the number of steps required to reduce n to a single-digit number by repeatedly summing its digits.

## sample
5
0