CF2111A.Energy Crystals

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Energy Crystals

There are three energy crystals numbered 11, 22, and 33; let's denote the energy level of the ii-th crystal as aia_i. Initially, all of them are discharged, meaning their energy levels are equal to 00. Each crystal needs to be charged to level xx (exactly xx, not greater).

In one action, you can increase the energy level of any one crystal by any positive amount; however, the energy crystals are synchronized with each other, so an action can only be performed if the following condition is met afterward:

  • for each pair of crystals ii, jj, it must hold that aiaj2a_{i} \ge \lfloor\frac{a_{j}}{2}\rfloor.

What is the minimum number of actions required to charge all the crystals?

Input

Each test consists of several test cases. The first line contains a single integer tt (1t1041 \le t \le 10^{4}) — the number of test cases. The description of the test cases follows.

The only line of each test case contains a single integer xx (1x1091 \le x \le 10^{9}).

Output

For each test case, output a single integer — the minimum number of actions required to charge all energy crystals to level xx.

Note

In the first test case, one possible sequence of actions is:

$$$[0, 0, 0] \to [\color{red}{1}, 0, 0] \to [1, 0, \color{red}{1}] \to [1, \color{red}{1}, 1]$$</p><p>One of the possible sequences of actions in the second test case is:</p><p>$$[0, 0, 0] \to [\color{red}{1}, 0, 0] \to [1, \color{red}{1}, 0] \to [1, 1, \color{red}{2}] \to [\color{red}{3}, 1, 2] \to [3, \color{red}{5}, 2] \to [\color{red}{5}, 5, 2] \to [5, 5, \color{red}{5}]$$$

Samples

7
1
5
14
2025
31415
536870910
1000000000
3
7
9
23
31
59
61

在线编程 IDE

建议全屏模式获得最佳体验