#K2726. Alternating Bits Checker
Alternating Bits Checker
Alternating Bits Checker
You are given a positive integer \(N\). Your task is to check whether the binary representation of \(N\) has alternating bits (i.e. no two adjacent bits are the same). For example, the number 5 has binary representation \(101\), which has alternating bits; however, the number 7 has binary representation \(111\), which does not.
More formally, let the binary representation of \(N\) be \(b_kb_{k-1}\ldots b_1\), then the condition to check is:
\(\forall i\ (2 \leq i \leq k):\; b_i \neq b_{i-1}\)
If the condition holds, print "Yes"; otherwise, print "No".
inputFormat
The input consists of a single positive integer \(N\) provided via standard input (stdin).
outputFormat
Print a single line containing either "Yes" if the binary representation of \(N\) has alternating bits, or "No" otherwise. The output should be written to standard output (stdout).
## sample5
Yes