#include <iostream>
using namespace std;
int a[1000001];
int calc(int n)
{
  if(n==1) return 0;
  if(a[n] != 0) return a[n];
  a[n] = ((n % 2) == 0 ? calc(n/2) : calc(3*n+1));
  a[n]++;
  return a[n];
}
int main()
{
  int n;
  for(;;){
    cin >> n;
    if(n==0) break;
    cout << calc(n) << endl;
  }
  return 0;
}