9043 - The 3n+1 Problem   

Description

 Consider the following algorithm:

  1. Input n
  2. Set Count to be 0
  3. If n is equal to 1, then STOP
    Else Set 
  4. Count = Count +1
  5. GOTO Step 3.

Given one integer n. Please output the count after processing the algorithm.

Input

 The input includes multiple test cases. In each test case, the first line contains one integer n. Guarantee the algorithm won’t go into infinite steps when n is between 1 and 106.

1<= n <= 106

Output

 The one line contains one integer which indicates the count.

Sample Input  Download

Sample Output  Download

Tags




Discuss