Anand's Maths question
Submissions: 1258   Accuracy:

17.26%

  Difficulty: Easy   Marks: 2

Anand is a great mathematician, he always try new things and want to know the total count of numbers where, N XOR X == N OR X, where 0<=X<=N.

Input:
First line consists of T test cases. Only line of test case consists of integer N.

Output:
Single line output, prints the required output.

Constraints:
1<=T<=10^5
1<=N<=10^18

Example:
Input:

3
5
7
8
Output:
2
1
8

Explanation:
For the first test case 
    5 XOR 2 == 5 OR 2
    5 XOR 0 == 5 OR 0
    So the count is 2.

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Saksham Raj Seth
Author: saksham seth


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.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.