(*
ocamlfind ocamlopt -package batteries -linkpkg main.ml -o a.out
*)
open Batteries

let rec f s ac =
        let ss = 
                if s mod 2 = 0 then
                        s / 2
                else
                        3 * s + 1
        in
        let exists = List.exists (fun elmnt -> elmnt = ss) ac in
                if exists then
                        1 + List.length ac
                else
                        f ss ([ss] @ ac)

let () =
        Scanf.sscanf (read_line ()) "%d" (
                fun s -> 
                        f s [s]
        ) |> Printf.printf "%d\n"
