#include <iostream>
#include <unordered_map>

using namespace std;

unordered_map<int, int> memo;

int rec(int n) {
    if (memo.find(n) != memo.end()) {
        return memo[n];
    }
    if (n == 1) {
        return memo[n] = 0;
    }
    if (n % 2 == 0) {
        return memo[n] = 1 + rec(n / 2);
    } else {
        return memo[n] = 1 + rec(n * 3 + 1);
    }
}

int main() {
    int n;
    while (cin >> n) {
        if (n == 0) break;
        cout << rec(n) << endl;
    }
}
