Scanf.scanf "%d %d" (fun a b ->
    let rec gcd a b = if b = 0 then a else gcd b (a mod b) in

    let rec loop rest i acc =
        if rest = 1 then acc else
            if i * i > rest then acc + 1 else
                if rest mod i > 0 then loop rest (i + 1) acc else
                    let rec loop2 rest =
                        if rest mod i = 0 then loop2 (rest / i) else rest
                    in
                    loop (loop2 rest) (i + 1) (acc + 1)
    in
    loop (gcd a b) 2 1 |> Printf.printf "%d\n"
)