Stepping Stones

Maximize the number of landed stones when jump lengths grow by at least one each time and the last landing is stone N.

Easy3MathBinary searchInterviewNo attempts yetTime limit1sMemory limit256 MB

Problem

Seungtaek wants to cross a river. He cannot swim, so he crosses by stepping on the stones laid in the water.

He cannot swim, but he is very good at standing jumps, and he can jump straight to any spot he wants.

Seungtaek is standing on one bank. Stones numbered 1, 2, 3, ..., NN lie across the river in that order. Call the bank he starts from position 00 and stone ii position ii, so the length of one jump is the difference between the two positions.

The river is wide, so there are a great many stones. Seungtaek does not want to step on all of them, so he uses his jumping skill and steps on only a suitable number of them.

He is allowed to jump straight to the far bank, but to make the crossing more fun he fixed the following rules.

  1. The first jump may land on any stone. This jump is the first jump.
  2. From the second jump on, every jump must be at least 1 longer than the jump right before it.
  3. Stone NN must be stepped on.
  4. Moving from stone NN to the far bank is not a jump, so the rules above do not apply to it.

Find the largest number of stones Seungtaek can step on while following these rules.

Input

The first line contains the number of test cases TT (1T1000001 \le T \le 100\,000).

Each of the next TT lines contains one integer NN, the total number of stones (1N10161 \le N \le 10^{16}).

Output

For each test case, print on one line the largest number of stones Seungtaek can step on.