Check if a Number Is a Power of Two
Determine whether a given integer is a power of two using bitwise tricks.
Input format
A single integer X (0 ≤ X ≤ 10^12).
Output format
Print true if X is a power of two, otherwise false.
Constraints
- Values fit in a 64-bit signed integer
- Trailing whitespace and a trailing newline are ignored by the judge
Read from stdin, write to stdout. Sample cases below show the exact format.
Sample cases
Example 1
Input
1Expected output
trueExample 2
Input
2Expected output
true