let rec gcd n m = if m = 0 then n else gcd m (n % m)

let rec factorize acc i n =
    if n <= 1 then
        acc
    else if n < (i * i) then
        n :: acc
    else if n % i = 0 then
        factorize (i :: acc) i (n / i)
    else factorize acc (i + 1) n

let ab = System.Console.ReadLine().Split()
let a = ab.[0] |> int
let b = ab.[1] |> int
let g = gcd a b
let ans = factorize [] 2 g |> List.distinct |> List.length |> (+) 1
printfn "%d" ans
