Given a number N, the task is to find XOR of count of 0s and count of 1s in binary representation of a given number.
The first line of the testcase contains an integer T, denoting number of testcases. The next T lines contains one integer N each.
Print XOR of count of 0s and 1s in binary representation of the given number in separate lines
Input : 5 Output : 3 Binary representation : 101 Count of 0s = 1, Count of 1s = 2 1 XOR 2 = 3. Input : 7 Output : 3 Binary representation : 111 Count of 0s = 0 Count of 1s = 3 0 XOR 3 = 3.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.