#include <iostream>
using namespace std;

int a[1000000];

int colpro(int m){
    if(a[m] >= 0){
    }else if(m % 2 == 0){
        int ret = colpro(m / 2);
        a[m] = ret + 1;
    }else{
        int ret = colpro(3 * m + 1);
        a[m] = ret + 1;
    }
    return a[m];
}

int main(){
    for(int i = 0; i < 1000000; i++){
        a[i] = -1;
    }
    a[1] = 0;
    a[2] = 1;
    a[3] = 7;
    a[4] = 2;
    a[5] = 5;
    a[8] = 3;
    a[10] = 6;
    a[20] = 7;
    a[21] = 7;
    a[16] = 4;
    a[32] = 5;
    a[64] = 6;
    a[128] = 7;
    for(;;){
        int n;
        if(cin >> n){
            if(n == 0){
                break;
            }
            int l = 0;
            cout << colpro(n);
        }else{
            break;
        }
    }
    return 0;
}