Not a Tree Question

0

0 votes
Easy
Problem

You are Given a perfect Binary Tree with 1018 levels starting from level 1 and each level contains 2level-1 Nodes. Nodes are numbered from 1.(see image for reference). Perfect binary tree with 5 levels:

binary tree

You need to answer queries. Each query consists of a single number denoting a particular level of the given tree. You need the find the bitwise xor value of each element/number belonging to this particularly given level in the query. See sample input-output for clarity.

NOTE: Use Fast input-output like scanf and printf instead of cin, cout


INPUT

First Line consists of a single number Q  denoting the no. of queries.

Next, Q lines follow:

each line consists of a single no.  denoting the level of the perfect binary tree.


OUTPUT

For each query print a single number on each line, i.e the required output to each query.


CONSTRAINTS

1<=Q<=106

1<=L<=1018

  

Sample Input
2
3
1
Sample Output
0
1
Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

Xor of level 3 elements i.e= 4,5,6,7 = 0

Xor of level 1 elements i.e= 1 =1

Editor Image

?