let N = stream.ReadLine() |> int

let cl n =
  match n%2 with
  | 0 -> n/2
  | _ -> 3*n+1 

let rec rfn i x xs =
  let c = cl x
  if List.contains c xs
    then i+1
    else rfn (i+1) (cl x) (c::xs)

rfn 1 N [N]
