Number Series
Submissions: 716   Accuracy:

41.64%

  Difficulty: Basic   Marks: 1

Ishaan's friend, Charul, gave a challenge to Ishaan. He gave a series to Ishaan and asked him to find the Nth term of that series.
Ishaan is very weak at solving series, so he needs your help. Help him find the Nth term of the following series :
N    Nth term
1    0
2    1
3    0
4    2
.
.
.
10    1

Input : 
First line of input contains a single integer T denoting the number of test cases.
The only line of each test case contains an integer N.

Output : 
For each test case, print the required answer in a new line.

Constraints : 
1 <= T <= 200
1 <= N <= 10^9

Example : 
Input : 

5
1
2
3
4
10
Output : 
0
1
0
2
1

Explanation : 
The Nth term is given, solve the series.

 

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

Author: goyalanubhav11


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.