Under construction

Still being built. Things may change

Just like pickle

Time limit1sMemory limit1024 MB

Summary
Given x, find the fewest jumps of length 2^k, left or right, that take the grasshopper from 0 to x.
Level

Medium5 of 10

Topics
Bit manipulation, Math
Solved
No attempts yet

Statement

Grasshopper is standing on a line at a point with coordinate 00. In one turn it can choose any non-negative integer kk and jump to the left or to the right by the distance 2k2^k.

Find the minimum number of turns the grasshopper has to make to move from the point with coordinate 00 to the point with coordinate xx.

Input

The first line contains a single integer tt, the number of test cases (1≤t≤100 0001 \le t \le 100\,000).

Each test case consists of one line containing a single integer xx, the coordinate of the target point (−1018≤x≤1018-10^{18} \le x \le 10^{18}).

Output

For each test case, output a single integer: the minimum number of turns the grasshopper has to make.

Examples1

  1. Example 1

    Input
    5
    1
    -4
    0
    -7
    239
    
    Expected output
    1
    1
    0
    2
    3