Question
The Alternating Bits Crystal
In the Kingdom of Binaryland, a young engineer named Biton works with magical number crystals. Each crystal stores a non-negative integer, and its power depends on how its energy bits are arranged.
A crystal is considered stable if, in its binary form, the bits alternate perfectly — meaning no two neighboring bits are the same. Biton wants your help to check whether a given crystal is stable or not.
Your task is to examine the binary representation of the given number and determine whether its bits are alternating.
Input
The first line contains a single integer KaTeX can only parse string typed expression — the value stored inside the crystal.
Output
Print KaTeX can only parse string typed expression if the bits in the binary representation of KaTeX can only parse string typed expression alternate. Otherwise, print KaTeX can only parse string typed expression.
Example
Input
10
Output
1
Explanation
The binary form of KaTeX can only parse string typed expression is KaTeX can only parse string typed expression.
Each bit alternates with the next, so the crystal is stable.
Input
6
Output
0
Explanation
The binary form of KaTeX can only parse string typed expression is KaTeX can only parse string typed expression.
Since adjacent bits are the same, the crystal becomes unstable.
10
Output
1
Explanation
The binary form of KaTeX can only parse string typed expression is KaTeX can only parse string typed expression.
Each bit alternates with the next, so the crystal is stable.
Input
6
Output
0
Explanation
The binary form of KaTeX can only parse string typed expression is KaTeX can only parse string typed expression.
Since adjacent bits are the same, the crystal becomes unstable.