import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

def gcd(a, b):
    while b: a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)

def prime_factorize(m):
    pf={}
    for i in range(2, int(m**0.5)+1):
        while m % i == 0:
            pf[i] = pf.get(i, 0) + 1
            m //= i
    if m > 1: pf[m] = 1
    return pf

a,b = map(int, input().split())
g = gcd(a,b)
pf = prime_factorize(g)
print(len(pf.keys()) + 1) import sys sys sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline def gcd(a, b):
    while b: a, b = b, a % b
    return a gcd while b: a, b = b, a % b
     b return a a a a b b def lcm(a, b):
    return a * b // gcd(a, b) lcm return a * b // gcd(a, b) a * b // gcd(a, b) a * b a b gcd(a, b) gcd a b a a b b def prime_factorize(m):
    pf={}
    for i in range(2, int(m**0.5)+1):
        while m % i == 0:
            pf[i] = pf.get(i, 0) + 1
            m //= i
    if m > 1: pf[m] = 1
    return pf prime_factorize pf={} pf {} for i in range(2, int(m**0.5)+1):
        while m % i == 0:
            pf[i] = pf.get(i, 0) + 1
            m //= i
     i range(2, int(m**0.5)+1) range 2 int(m**0.5)+1 int(m**0.5) int m**0.5 m 0.5 1 while m % i == 0:
            pf[i] = pf.get(i, 0) + 1
            m //= i
     m % i == 0 m % i m i 0 pf[i] = pf.get(i, 0) + 1 pf[i] pf i pf.get(i, 0) + 1 pf.get(i, 0) pf.get pf get i 0 1 m //= i m i if m > 1: pf[m] = 1
     m > 1 m 1 return pf pf m m a,b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b g = gcd(a,b) g gcd(a,b) gcd a b pf = prime_factorize(g) pf prime_factorize(g) prime_factorize g print(len(pf.keys()) + 1) print len(pf.keys()) + 1 len(pf.keys()) len pf.keys() pf.keys pf keys 1 pf = prime_factorize(g) prime_factorize(g) pf input = sys.stdin.readline sys.stdin.readline input a,b = map(int, input().split()) map(int, input().split()) a def gcd(a, b):
    while b: a, b = b, a % b
    return a def gcd(a, b):
    while b: a, b = b, a % b
    return a gcd g = gcd(a,b) gcd(a,b) g def lcm(a, b):
    return a * b // gcd(a, b) def lcm(a, b):
    return a * b // gcd(a, b) lcm def prime_factorize(m):
    pf={}
    for i in range(2, int(m**0.5)+1):
        while m % i == 0:
            pf[i] = pf.get(i, 0) + 1
            m //= i
    if m > 1: pf[m] = 1
    return pf def prime_factorize(m):
    pf={}
    for i in range(2, int(m**0.5)+1):
        while m % i == 0:
            pf[i] = pf.get(i, 0) + 1
            m //= i
    if m > 1: pf[m] = 1
    return pf prime_factorize b = map(int, input().split()) map(int, input().split()) b
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

def gcd(a, b):
    while b: a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)

def prime_factorize(m):
    pf={}
    for i in range(2, int(m**0.5)+1):
        while m % i == 0:
            pf[i] = pf.get(i, 0) + 1
            m //= i
    if m > 1: pf[m] = 1
    return pf

a,b = map(int, input().split())
g = gcd(a,b)
pf = prime_factorize(g)
print(len(pf.keys()) + 1)
