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
  let rec f i x = if a.(x) then i else
    (a.(x) <- true; f (i+1) (col x))
  in print_int @@ f 1 n))