Under construction

Still being built. Things may change

Gaokao

Time limit1sMemory limit256 MB

Summary
For each of up to 500 queries, count how many entries in row K of Pascal's triangle are odd, where K can reach 10^18.
Level

Medium4 of 10

Topics
Math, Combinatorics, Bit manipulation, Number theory
Solved
No attempts yet

Problem

Roundgod is about to attend Gaokao (National Unified Examination for Admissions to General Universities and Colleges) and his dream school is Zhejiang University. He sees an interesting problem while he is studying Math, which is a problem related to Pascal's Triangle.

The definition of Pascal's Triangle is given below:

The first element and the last element of each row in Pascal's Triangle is 11, and the mthm_{th} element of the nthn_{th} row equals to the sum of the mthm_{th} and the (m−1m-1)th_{th} element of the (n−1n-1)th_{th} row. Here's an example of a 5 levels Pascal's Triangle .

11 111\quad 1 1211 \quad2\quad 1 13311 \quad3 \quad3\quad 1 146411 \quad4\quad 6\quad 4 \quad1

In the task, Roundgod is required to calculate how many elements in the 126th126_{th} row of Pascal's Triangle are odd numbers.

After solving it, Roundgod thinks of a harder version of this problem. He gives you many requests about similar questions but the row number will be bigger. Please calculate that how many elements in the kthk_{th} row of Pascal's Triangle are odd numbers.

Input

There are multiple test cases. The first line of the input contains an integer TT (1≤T≤5001 \le T \le 500), indicating the number of test cases. For each test case:

The first and only line contains an integer K$$(K\leq 10^{18}), indicating the required row number in Pascal's Triangle.

Output

For each test case, output the number of odd numbers in the kthk_{th} line.

Examples1

  1. Example 1

    Input
    3
    3
    4
    5
    
    Expected output
    2
    4
    2