#Lutece0593. flip

flip

Migrated from Lutece 593 flip

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

Give you a non-negative integer xx and an operation. The only operation you can do is to reverse one bit in binary form of xx once(i.e 101\rightarrow 0, 010\rightarrow 1).

your goal is to turn xx into x+1x+1.

Calculate the minimum times of operations you need to do.

Input

The first line of the input is an integer TT indicates the test cases.

Then follow TT lines. Each line is a non-negative integer xx as described above, note that 0x<1090\leq x<10^9.

Output

Output the minimum times of operations you need to do to reach the goal.

Samples

3
1
2
3
2
1
3

Resources

Sichuan University Programming Contest