Scanf.scanf "%d %d %d" (fun a b c ->
    let module S = Set.Make (struct type t = int * int * int let compare = compare end) in

    let rec loop i a b c set =
        let key = (a, b, c) in
        if S.mem key set then (-1) else
            if (a land 1) lor (b land 1) lor (c land 1) > 0 then i else
                loop (i + 1) ((b + c) / 2) ((a + c) / 2) ((a + b) / 2) (S.add key set)
    in
    loop 0 a b c S.empty |> Printf.printf "%d\n"
)