#P7100. Cut The Wire

    ID: 5957 远端评测题 1000ms 256MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>2021中国大学生程序设计竞赛(CCPC)- 网络选拔赛

Cut The Wire

Problem Description

In the country of Infinity , there is a strange road. This road only has a starting point, but no end. Since this road is infinite, there are also countless street lights. The street lights are numbered from $1$(the starting point) to infinity. The street lights are connected by wires under a strange law:

For a street light $x$,



  • if $x$ is even, then $x$ is connected with $\frac{x}{2}$ by a wire;


  • if $x$ is odd, then $x$ and $3x + 1$ is connected by a wire.



Now Kris is standing in the middle of street light $n$ and $n + 1$, and he is able to cut all wires passing by. That is, he will cut all wires connecting street lights $a$ and $b$ satisfying $a \leq n$ and $b > n$.

Now he wonders, how many wires he will cut. Please help him calculate.

Input

This problem contains multiple test cases.

The first line contains an integer $T(1 \leq T \leq 10 ^ 5)$ indicating the number of test cases.

The next $T$ lines each contains one integer $n(1 \leq n \leq 10 ^ 9)$.

Output

For each test case, output one line of one integer indicating the answer.

2 12 60
10 50