Recursion
Recursion-07
Recursion-08
Recursion-09
~/algor $ cat problems/rekursiya-2-ning-darajasi-tekshirish
Power of two
Easy
1000 ms
64 MB
26%
You are given a positive integer $n$. Using a recursive function, determine whether $n$ is a non-negative integer power of $2$ ($2^0, 2^1, 2^2, \dots$).
Recursive logic: if $n = 1$ — YES; if $n$ is odd — NO; otherwise check $n \mathbin{/} 2$ recursively.
Input
One line with one positive integer $n$ ($1 \le n \le 10^9$).
Output
Print YES if $n$ is a power of $2$, otherwise NO.
Note
$1 \le n \le 10^9$
Examples
Input #1
8
Output #1
YES
Input #2
12
Output #2
NO