LogiQuest

492. Valid Perfect Square

EasyBinary Search

Print YES if n is a perfect square, else NO, without using a square-root function.

Input format

One integer n

Output format

YES or NO

Example 1

Input

16

Output

YES

Example 2

Input

14

Output

NO

Constraints

1 ≤ n ≤ 2³¹ − 1

Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.

Loading the MyLoginn IDE…