#C9634. Power of Two Check
Power of Two Check
Power of Two Check
Given an integer n, determine whether it is a power of two. A number n is a power of two if and only if it can be written as \(2^k\) for some non-negative integer \(k\). In other words, n is a power of two if \(n > 0\) and \(n \& (n - 1) = 0\). This problem requires you to implement a solution that reads the input from the standard input (stdin) and prints the output to the standard output (stdout).
Example:
- If
n = 4
, since \(4 = 2^2\), the output should be "YES". - If
n = 5
, since 5 is not a power of two, the output should be "NO".
inputFormat
The input consists of a single integer \(n\) (1 \(\leq\) n \(\leq\) 106), provided on a single line.
outputFormat
Output a single string "YES" if \(n\) is a power of two, otherwise output "NO".
## sample1
YES