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
/*
 * 0158.cpp
 *
 *  Created on: 2011/07/27
 *      Author: isa
 */

#include <iostream>
#include <cstring>

using namespace std;

int m[1000001];

void func(long long num, int times){
	if(num > 1000000 || m[num] != -1) return;
	m[num] = times;
	func(num*2,times+1);
	if((num-1)%3 == 0 && ((num-1)/3)%2 == 1){
		func((num-1)/3, times+1);
	}
}

int main(void){
	int n;
	memset(m,-1,sizeof(m));
	m[1] = 0;
	func(2,1);
	while(cin >> n && n) cout << m[n] << endl;
}