module IntSet = Set.Make (struct
  type t = int
  let compare = compare
end)

let () = Scanf.scanf "%d" @@ fun s -> 
  let rec solve s an n =
    if IntSet.mem an s then n
    else solve (IntSet.add an s) (if an mod 2 = 0 then an / 2 else 3 * an + 1) (n + 1) in
  Printf.printf "%d\n" @@ solve IntSet.empty s 1
