from math import sqrt
from math import ceil
def prime_factorization(n):
    pfs = [1]
    i = 2
    for i in range(2, int(ceil(sqrt(n)))):
        while n % i == 0:
            pfs.append(i)
            n //= i
    if n > 0:
        pfs.append(n)
    return pfs


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


def bit_search(pfs):
    m = len(pfs)
    ds = set([])
    for i in range(1 << m):
        d = 1
        for j in range(m):
            if i & (1 << m) > 0:
                d *= pfs[m]
        ds.add(d)
    return ds

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

gcdab = gcd(a, b)
#print (gcdab)
pfsab = prime_factorization(gcdab)
#print (pfsab)
pfsabset =set(pfsab)
print (len(pfsabset)) from math import sqrt from math import ceil def prime_factorization(n):
    pfs = [1]
    i = 2
    for i in range(2, int(ceil(sqrt(n)))):
        while n % i == 0:
            pfs.append(i)
            n //= i
    if n > 0:
        pfs.append(n)
    return pfs prime_factorization pfs = [1] pfs [1] 1 i = 2 i 2 for i in range(2, int(ceil(sqrt(n)))):
        while n % i == 0:
            pfs.append(i)
            n //= i
     i range(2, int(ceil(sqrt(n)))) range 2 int(ceil(sqrt(n))) int ceil(sqrt(n)) ceil sqrt(n) sqrt n while n % i == 0:
            pfs.append(i)
            n //= i
     n % i == 0 n % i n i 0 pfs.append(i) pfs.append pfs append i n //= i n i if n > 0:
        pfs.append(n)
     n > 0 n 0 pfs.append(n) pfs.append pfs append n return pfs pfs n n a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b def bit_search(pfs):
    m = len(pfs)
    ds = set([])
    for i in range(1 << m):
        d = 1
        for j in range(m):
            if i & (1 << m) > 0:
                d *= pfs[m]
        ds.add(d)
    return ds bit_search m = len(pfs) m len(pfs) len pfs ds = set([]) ds set([]) set [] for i in range(1 << m):
        d = 1
        for j in range(m):
            if i & (1 << m) > 0:
                d *= pfs[m]
        ds.add(d)
     i range(1 << m) range 1 << m 1 m d = 1 d 1 for j in range(m):
            if i & (1 << m) > 0:
                d *= pfs[m]
         j range(m) range m if i & (1 << m) > 0:
                d *= pfs[m]
         i & (1 << m) > 0 i & (1 << m) i 1 << m 1 m 0 d *= pfs[m] d pfs[m] pfs m ds.add(d) ds.add ds add d return ds ds pfs pfs def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b) gcd if b == 0:
        return a
    else:
        return gcd(b, a % b) b == 0 b 0 return a a return gcd(b, a % b) gcd(b, a % b) gcd b a % b a b a a b b gcdab = gcd(a, b) gcdab gcd(a, b) gcd a b pfsab = prime_factorization(gcdab) pfsab prime_factorization(gcdab) prime_factorization gcdab pfsabset =set(pfsab) pfsabset set(pfsab) set pfsab print (len(pfsabset)) print len(pfsabset) len pfsabset def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b) def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b) gcd def prime_factorization(n):
    pfs = [1]
    i = 2
    for i in range(2, int(ceil(sqrt(n)))):
        while n % i == 0:
            pfs.append(i)
            n //= i
    if n > 0:
        pfs.append(n)
    return pfs def prime_factorization(n):
    pfs = [1]
    i = 2
    for i in range(2, int(ceil(sqrt(n)))):
        while n % i == 0:
            pfs.append(i)
            n //= i
    if n > 0:
        pfs.append(n)
    return pfs prime_factorization gcdab = gcd(a, b) gcd(a, b) gcdab pfsab = prime_factorization(gcdab) prime_factorization(gcdab) pfsab a, b = map(int, input().split()) map(int, input().split()) a pfsabset =set(pfsab) set(pfsab) pfsabset b = map(int, input().split()) map(int, input().split()) b def bit_search(pfs):
    m = len(pfs)
    ds = set([])
    for i in range(1 << m):
        d = 1
        for j in range(m):
            if i & (1 << m) > 0:
                d *= pfs[m]
        ds.add(d)
    return ds def bit_search(pfs):
    m = len(pfs)
    ds = set([])
    for i in range(1 << m):
        d = 1
        for j in range(m):
            if i & (1 << m) > 0:
                d *= pfs[m]
        ds.add(d)
    return ds bit_search
from math import sqrt
from math import ceil
def prime_factorization(n):
    pfs = [1]
    i = 2
    for i in range(2, int(ceil(sqrt(n)))):
        while n % i == 0:
            pfs.append(i)
            n //= i
    if n > 0:
        pfs.append(n)
    return pfs


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


def bit_search(pfs):
    m = len(pfs)
    ds = set([])
    for i in range(1 << m):
        d = 1
        for j in range(m):
            if i & (1 << m) > 0:
                d *= pfs[m]
        ds.add(d)
    return ds

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

gcdab = gcd(a, b)
#print (gcdab)
pfsab = prime_factorization(gcdab)
#print (pfsab)
pfsabset =set(pfsab)
print (len(pfsabset))