SP7733 HPYNOS - Happy Numbers I

Description

The process of “**breaking**” an integer is defined as summing the squares of its digits. For example, the result of breaking the integer **125** is (**1 $ ^{2} $** + **2 $ ^{2} $** + **5 $ ^{2} $** ) = **30**. An integer **N** is **happy** if after “**breaking**” it repeatedly the result reaches 1. If the result never reaches 1 no matter how many times the “**breaking**” is repeated, then N is not a happy number. **TASK** Write a program that given an integer N, determines whether it is a happy number or not. **CONSTRAINTS** 2 N

Input Format

A single line containing a single integer **N**.

Output Format

A single line containing a single integer **T** which is the number of times the process had to be done to determine that N is happy, or **-1** if **N** is not happy.