[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reada f = stdin.ReadLine().Split() |> Array.map f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

let gcd x y =
    let rec aux x y = if y = 0L then x else aux y (x % y)
    aux (abs x) (abs y)

let lcm x y = if x = 0L || y = 0L then 0L else abs ((x / (gcd x y)) * y)

let isPrime n =
  let sqrt' = (float >> sqrt >> int64) n // square root of integer
  [ 2L .. sqrt' ] // all numbers from 2 to sqrt'
  |> List.forall (fun x -> n % x <> 0L) // no divisors

let allPrimes =
  let rec allPrimes' n =
    seq { // sequences are lazy, so we can make them infinite
      if isPrime n then
        yield n
      yield! allPrimes' (n+1L) // recursing
    }
  allPrimes' 2L // starting from 2

[<EntryPoint>]
let main _ =
    let [a;b] = reads int64
    let g = gcd a b
    // let g' = (float >> sqrt >> int64) g
    allPrimes
    |> Seq.takeWhile (fun x -> x <= g)
    |> Seq.filter (fun x -> g % x = 0L)
    |> Seq.length
    |> (+) 1
    |> printfn "%i"
    // |> printfn "%A"
    0