CF2111A Energy Crystals

Description

There are three energy crystals numbered $ 1 $ , $ 2 $ , and $ 3 $ ; let's denote the energy level of the $ i $ -th crystal as $ a_i $ . Initially, all of them are discharged, meaning their energy levels are equal to $ 0 $ . Each crystal needs to be charged to level $ x $ (exactly $ x $ , 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 $ i $ , $ j $ , it must hold that $ a_{i} \ge \lfloor\frac{a_{j}}{2}\rfloor $ . What is the minimum number of actions required to charge all the crystals?

Input Format

Each test consists of several test cases. The first line contains a single integer $ t $ ( $ 1 \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 $ x $ ( $ 1 \le x \le 10^{9} $ ).

Output Format

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

Explanation/Hint

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] $$ One of the possible sequences of actions in the second test case is: $$ [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}] $$