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.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	int n;
	int max=1000001;
	int[] memo=new int[max];

	void run(){
		Arrays.fill(memo, -1);
		LinkedList<Integer> que=new LinkedList<Integer>();
		que.offer(1);
		memo[1]=0;
		for(; !que.isEmpty();){
			int m=que.poll();
			if(m*2<max&&memo[m*2]==-1){
				que.offer(m*2);
				memo[m*2]=memo[m]+1;
			}
			if((m-1)%3==0&&(m-1)%2!=0&&memo[(m-1)/3]==-1){
				que.offer((m-1)/3);
				memo[(m-1)/3]=memo[m]+1;
			}
		}
		/*
		for(int i=1; i<max; i++){
			if(memo[i]!=-1&&memo[i]!=cal(i)){
				debug(i, memo[i],cal(i));
				break;
			}
		}*/
		for(;;){
			n=sc.nextInt();
			if(n==0){
				break;
			}
			println(""+memo[n]);
		}
	}

	int cal(int n){
		for(int i=0;; i++){
			if(n==1){
				return i;
			}
			if(n%2==0){
				n/=2;
			}else{
				n=3*n+1;
			}
		}
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}