#SDNU1509. G.Triple Nim

G.Triple Nim

Description

Alice and Bob are always playing all kinds of Nim games and Alice always goes first. Here is the rule of Nim game:

There are some distinct heaps of stones. On each turn, two players should remove at least one stone from just one heap. Two player will remove stone one after another. The player who remove the last stone of the last heap will win.

Alice always wins and Bob is very unhappy. So he decides to make a game which Alice will never win. He begins a game called “Triple Nim”, which is the Nim game with three heaps of stones. He’s good at Nim game but bad as math. With exactly N stones, how many ways can he finish his target? Both Alice and Bob will play optimally.

Input

Multiple test cases. The first line contains an integer T(T100000)T (T \leq 100000), indicating the number of test case. Each case contains one line, an integer N(3N1000000000)N (3 \leq N \leq 1000000000) indicating the number of stones Bob have.

Output

One line per case. The number of ways Bob can make Alice never win.

Sample Input

3
3
6
14

Sample Output

0
1
4

Hint

In the third case, Bob can make three heaps (1,6,7),(2,5,7),(3,4,7)or(3,5,6)(1,6,7), (2,5,7), (3,4,7) or (3,5,6).