let a, b = Scanf.sscanf (read_line ()) "%d %d" @@ fun a b -> (a, b)

let rec prime_numbers acc x = function
  | 0 | 1 -> acc
  | n ->
    let rec f i j = if i mod j = 0 then f (i / j) j else i in
    if n mod x = 0 then prime_numbers (x :: acc) (x + 1) (f n x)
    else if x * x > n then acc
    else prime_numbers acc (x + 1) n

let () =
  let acc = prime_numbers [] 2 b in
  acc
  |> List.filter (fun i -> a mod i = 0 && b mod i = 0)
  |> List.length
  |> ((+) 1)
  |> Printf.printf "%d\n"