LearnPy Hub
← Arena
IntermediateRating 1100

Happy Number

Replace n by the sum of the squares of its digits repeatedly. Print YES if this reaches 1, NO if it loops forever (detect a repeat with a set).

Input

One integer.

Output

YES or NO.

Sample 1

Input
19
Output
YES

Sample 2

Input
2
Output
NO
solution.py
Output appears here
Happy Number · Python Arena problem · LearnPy Hub