#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

int dp[1000002];
int rec(int a) {
  int prev = a;
  if (dp[a] >= 0) return dp[a];
  if (a == 1) return 0;
  if (a % 2) {
    a *= 3;
    a++;
  } else {
    a >>= 1;
  }
  return dp[prev] = 1 + rec(a);
}

int main() {
  memset(dp, -1, sizeof dp);
  int n;
  while (cin >> n, n) {
    cout << rec(n) << endl;
  }
  return 0;
}