For a positive integer n

* If n is even, divide by 2.
* If n is odd, multiply by 3 and add 1.



If you repeat the above operation, the result will be 1. A problem called "Colatz conjecture" is that repeating this operation for any positive integer n will always result in 1. This problem is an unsolved problem, also known as the "Kakutani problem" in Japan. It is known that there is no counterexample for a very large number 3 × 253 = 27,021,597,764,222,976 using a computer, but it has not been mathematically proven.

Create a program that takes the integer n as an input and outputs the number of operations that are repeated until the result is 1. The integer n should be an integer that is 1 or more and the value in the middle of repeating the above calculation is 1000000 or less. For example, if you receive 3 as input, the operation column will be


3 → 10 → 5 → 16 → 8 → 4 → 2 → 1


Therefore, 7 is output, which is the number of operations (the number of arrows above).



Input

A sequence of multiple datasets is given as input. The end of the input is indicated by a single line of zeros. One integer n (n ≤ 1000000) is given on one row for each dataset.

The number of datasets does not exceed 50.

Output

Outputs the number of operations for each dataset on one line.

Example

Input

3
10
0


Output

7
6
import java.util.*;


class Main {
        public static int dp[];
        public static int MM = 1000001;
        public static void main(String args[]) {
                Scanner sc = new Scanner(System.in);
                dp = new int[MM];
                for (int i = 0; i < MM; i++) {
                        dp[i] = -1;
                }
                while (true) {
                        int N = sc.nextInt();
                        if (N == 0) {
                                break;
                        }
                        System.out.println(recursion(N));
                }
        }
        public static int recursion(int in) {
                if (in == 1) {
                        return 0;
                }
                if (in < MM) {
                        if (dp[in] != -1) {
                                return dp[in];
                        } else {
                                if (in % 2 == 1) {
                                        return dp[in] = recursion(in * 3 + 1) + 1;
                                } else {
                                        return dp[in] = recursion(in / 2) + 1;
                                }
                        }
                } else {
                        if (in % 2 == 1) {
                                return recursion(in * 3 + 1) + 1;
                        } else {
                                return recursion(in / 2) + 1;
                        }
                }
        }
}