Maximize XOR
Submissions: 313   Accuracy:

31.31%

  Difficulty: Easy   Marks: 2

Given a number X find the total numbers A such that

A XOR X >= X,  and

1<=A<=X.

Input:

The first line contains an integer T denoting number f testcases. The following T lines contains an integer X each.


Output:

Print the total count of the different value of A possible. 
Constraints:

1<=T<=10^5

1<=X<=10^8


Example:

Input

2

10

5

Output

5

2

Explanation:

In the range [1,10] if the XOR is taken of 10 and any number in the set {1,4,5,6,7} the resulting value will be greater than or equal to 10.

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

Author: ShivamKD


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.