let f n = if n mod 2 = 0 then n / 2 else (3 * n) + 1
let occurence = Array.make 1000001 false
let memo = Array.make 1000001 None
let memo_seq s i =
  let rec inner i =
    match memo.(i) with
    | None -> if i = 1 then s 
              else let ans = f (inner (i - 1)) in memo.(i) <- Some ans; ans
    | Some j -> j 
  in inner i

let rec search s m = 
  let v = memo_seq s m in 
  if occurence.(v) then m else (occurence.(v) <- true; search s (m + 1))

let _ =
  let s = Scanf.scanf "%d" (fun s -> s) in
  search s 2 |> print_int