let kMax = 1000000

let _ =
  let s = Scanf.scanf "%d" @@ (+) 0 in
  let flags = Array.make (kMax + 10) false in
  flags.(s) <- true;
  let n = ref s in
  for i = 2 to kMax do
    n := if !n mod 2 = 0 then !n / 2 else 3 * !n + 1;
    if flags.(!n) then (Printf.printf "%d\n" i; exit 0);
    flags.(!n) <- true
  done