Persistence

Count how many times multiplying the decimal digits together reduces the given number to a single digit.

Easy1SimulationImplementationInterviewNo attempts yetTime limit1sMemory limit256 MB

Problem

Kipa likes multiplication. When Kipa sees a number, Kipa multiplies all of its digits together to build a new number, then repeats the same work on that new number. Once the number has only one digit there is nothing left to multiply, and Kipa becomes sad.

Write a program that prints how many steps Kipa's joy lasts. For example, 679679 shrinks like this.

  • 6796×7×9=378679 \to 6 \times 7 \times 9 = 378 (step 1)
  • 3783×7×8=168378 \to 3 \times 7 \times 8 = 168 (step 2)
  • 1681×6×8=48168 \to 1 \times 6 \times 8 = 48 (step 3)
  • 484×8=3248 \to 4 \times 8 = 32 (step 4)
  • 323×2=632 \to 3 \times 2 = 6 (step 5, the number now has one digit and Kipa becomes sad)

679679 reaches one digit after 5 steps, so the answer is 5.

Input

The first line contains one integer NN with at most 9 digits and no leading zero. (1N9999999991 \le N \le 999999999)

Output

Print the number of steps Kipa's joy lasts on the first line. If NN already has one digit, print 0.