Welcome to ZOJ
Information
Select Problem
Runs
Ranklist
ZOJ Problem Set - 4005
Lucky Man

Time Limit: 2 Seconds      Memory Limit: 65536 KB

BaoBao is keen on collection. Recently he is abandoning himself to Kantai Collection, especially to collecting cute girls, known as "Fleet Girls".

There are \(n\) various types of girls in the game. To get a girl, one can use some materials to build her. The probability to get a type of girl by building is the same for all types of girls. From the Coupon Collector's Problem we know that, to collect all types of girls, the expected number of times of building is \(\sum\limits_{i=1}^n\frac{n}{n-i+1}\).

But this rule does not apply to BaoBao, as he is always luckier than the ordinary players (maybe because he's an European). For BaoBao to collect all types of girls, the expected number of times of building is \(s = \sum\limits_{i=1}^n\left\lfloor\frac{n}{n-i+1}\right\rfloor\), where \(\lfloor x \rfloor\) means the maximum integer that doesn't exceed \(x\).

As a lucky man, BaoBao is not interested in the actual value of \(s\), and he just wants to know whether \(s\) is odd or even. Can you help him?

Input

The first line of the input is an interger \(T\) (about 100), indicating the number of test cases. For each test case:

The first line contains an integer \(n\) (\(0 \le n \le 10^{1000}\)), indicating the number of types of girls.

Output

For each test case, if \(s\) is odd output "1" (without quotes), if \(s\) is even output "0" (without quotes).

Sample Input

9
2
3
23
233
2333
23333
233333
2333333
23333333

Sample Output

1
1
0
1
0
0
1
1
0

Author: ZHAO, Jinglin
Source: ZOJ Monthly, March 2018
Submit    Status