文理学院程序设计在线练习


Weight

Time Limit: 1 Second(s)    Memory Limit: 32 MB

Total Submission(s): 35   Accepted Submission(s): 23
Problem Description

These days Mr. Frog has got a piece of weight(砝码) weighs n grams. He wants to use it to measure things whose weight ranges from 1 to n. Now he can cut some times to make the weight separated into several integer-weighted pieces. Then choose some of them and put them on the right side of the balance to measure things.

But what’s the minimum times he must cut?

For example:
N = 7, Frog cut it twice. The 3 parts each weighs 1, 2, 4.
Then 1 = 1 , 2 = 2 , 3 = 1 + 2 , 4 = 4 , 5 = 4 + 1, 6 = 2 + 4,7 = 1 + 2 + 4.We can measure things whose weight ranges from 1 to 7.

Input

The first line of the input contains an integer T(T<=100) ,indicating the number of cases.
The following T lines each has a positive integer n(n <= 10^6), indicating the weight weighs.

Output

For each case, you should output the minimum times Frog should cut the gold.

Sample Input
3
1
2
7
Sample Output
0
1
2