LearnPy Hub
← Arena
EasyRating 900

Power of Three

Print YES if n = 3^k for some k ≥ 0.

Input

One integer n (1 ≤ n ≤ 10¹⁸).

Output

YES or NO.

Sample 1

Input
27
Output
YES

Sample 2

Input
1
Output
YES
solution.py
Output appears here
Power of Three · Python Arena problem · LearnPy Hub