
a,b = map(int,input().split())

import math
g = math.gcd(a,b)

"""
gを素因数分解したときの素因数のリストの要素数 + 「1」を含める

g == 1のとき
1
g != 1のとき
素因数リストの要素数 +1
"""



def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


gdlist = prime_factorize(g)
if gdlist ==[]:
    print(1)
else:
    print(len(set(gdlist))+1) a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b import math math g = math.gcd(a,b) g math.gcd(a,b) math.gcd math gcd a b """
gを素因数分解したときの素因数のリストの要素数 + 「1」を含める

g == 1のとき
1
g != 1のとき
素因数リストの要素数 +1
""" def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a prime_factorize a = [] a [] while n % 2 == 0:
        a.append(2)
        n //= 2
     n % 2 == 0 n % 2 n 2 0 a.append(2) a.append a append 2 n //= 2 n 2 f = 3 f 3 while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
     f * f <= n f * f f f n if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
     n % f == 0 n % f n f 0 a.append(f) a.append a append f n //= f n f f += 2 f 2 if n != 1:
        a.append(n)
     n != 1 n 1 a.append(n) a.append a append n return a a n n gdlist = prime_factorize(g) gdlist prime_factorize(g) prime_factorize g if gdlist ==[]:
    print(1)
else:
    print(len(set(gdlist))+1) gdlist ==[] gdlist [] print(1) print 1 print(len(set(gdlist))+1) print len(set(gdlist))+1 len(set(gdlist)) len set(gdlist) set gdlist 1 b = map(int,input().split()) map(int,input().split()) b g = math.gcd(a,b) math.gcd(a,b) g def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a prime_factorize gdlist = prime_factorize(g) prime_factorize(g) gdlist a,b = map(int,input().split()) map(int,input().split()) a

a,b = map(int,input().split())

import math
g = math.gcd(a,b)

"""
gを素因数分解したときの素因数のリストの要素数 + 「1」を含める

g == 1のとき
1
g != 1のとき
素因数リストの要素数 +1
"""



def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


gdlist = prime_factorize(g)
if gdlist ==[]:
    print(1)
else:
    print(len(set(gdlist))+1)