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

let rec f n ac =
        let nn = 
                if n mod 2 = 0 then
                        n / 2
                else
                        3 * n + 1
        in
        let exists = List.exists (fun elmnt -> elmnt = nn) ac in
                if exists then
                        2 + List.length ac
                else
                        f nn (nn :: ac)

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