e-olymp
favorite We need a little bit of your help to keep things running, click on this banner to learn more
Problems

The level of palindrome

The level of palindrome

prb29

You have a positive integer m. If it is not a palindrome, than we write it in back order and add it to original number m. Steps are repeated till we'll receive a number - palindrome. The number of such operations we call the palindrome level for m.

Find the level of palindrome for m.

Input

One number m (0 < m < 10000).

Output

Print the palindrome level for m.

Time limit 1 second
Memory limit 122.17 MiB
Input example #1
865
Output example #1
2