let rec fix f x = f (fix f) x;;
Scanf.(Array.(scanf " %d" @@ fun n ->
  let a = make 2000000 false in
  let col n = if n mod 2 = 0 then n/2 else 3*n+1 in
  print_int @@ fix (fun f i x ->
    if a.(x) then i
    else (
      a.(x) <- true;
      f (i+1) (col x)
    )
  ) 1 n))