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
Output appears hereOne integer n (1 ≤ n ≤ 10¹⁸).
YES or NO.
27
YES
1
YES
Output appears here