Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/rekursiya-2-ning-darajasi-tekshirish

Power of two

Easy 1000 ms 64 MB 26%
Share

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.

The number is halved in every call and reaches 1

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

Sign in to submit a solution

Signing up is free and takes a minute.