primes = []
boo = [True] * (int(1e6) + 1)
boo[0] = False; boo[1] = False
for i in range(2, len(boo)):
    if boo[i]:
        for j in range(i*i, len(boo), i):
            boo[j] = False
        primes.append(i)
        
# Finds the prime factors of a number
def findPF(num):
    ans = []
    PF_idx = 0
    PF = primes[PF_idx]
    while PF * PF <= num:
        while num % PF == 0:
            num //= PF
            ans.append(PF)
        PF_idx += 1
        PF = primes[PF_idx]
    if num != 1:
        ans.append(num)
    return ans

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

a, b = map(int, input().split())
temp = gcd(a, b)
print(len(set(findPF(temp)))+1) primes = [] primes [] boo = [True] * (int(1e6) + 1) boo [True] * (int(1e6) + 1) [True] True int(1e6) + 1 int(1e6) int 1e6 1 boo[0] = False boo[0] boo 0 False boo[1] = False boo[1] boo 1 False for i in range(2, len(boo)):
    if boo[i]:
        for j in range(i*i, len(boo), i):
            boo[j] = False
        primes.append(i)
        
# Finds the prime factors of a number i range(2, len(boo)) range 2 len(boo) len boo if boo[i]:
        for j in range(i*i, len(boo), i):
            boo[j] = False
        primes.append(i)
        
# Finds the prime factors of a number boo[i] boo i for j in range(i*i, len(boo), i):
            boo[j] = False
         j range(i*i, len(boo), i) range i*i i i len(boo) len boo i boo[j] = False boo[j] boo j False primes.append(i) primes.append primes append i def findPF(num):
    ans = []
    PF_idx = 0
    PF = primes[PF_idx]
    while PF * PF <= num:
        while num % PF == 0:
            num //= PF
            ans.append(PF)
        PF_idx += 1
        PF = primes[PF_idx]
    if num != 1:
        ans.append(num)
    return ans findPF ans = [] ans [] PF_idx = 0 PF_idx 0 PF = primes[PF_idx] PF primes[PF_idx] primes PF_idx while PF * PF <= num:
        while num % PF == 0:
            num //= PF
            ans.append(PF)
        PF_idx += 1
        PF = primes[PF_idx]
     PF * PF <= num PF * PF PF PF num while num % PF == 0:
            num //= PF
            ans.append(PF)
         num % PF == 0 num % PF num PF 0 num //= PF num PF ans.append(PF) ans.append ans append PF PF_idx += 1 PF_idx 1 PF = primes[PF_idx] PF primes[PF_idx] primes PF_idx if num != 1:
        ans.append(num)
     num != 1 num 1 ans.append(num) ans.append ans append num return ans ans num num def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b) gcd if b == 0:
        return a
     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 a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b temp = gcd(a, b) temp gcd(a, b) gcd a b print(len(set(findPF(temp)))+1) print len(set(findPF(temp)))+1 len(set(findPF(temp))) len set(findPF(temp)) set findPF(temp) findPF temp 1 a, b = map(int, input().split()) map(int, input().split()) a def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b) def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b) gcd primes = [] [] primes boo = [True] * (int(1e6) + 1) [True] * (int(1e6) + 1) boo b = map(int, input().split()) map(int, input().split()) b def findPF(num):
    ans = []
    PF_idx = 0
    PF = primes[PF_idx]
    while PF * PF <= num:
        while num % PF == 0:
            num //= PF
            ans.append(PF)
        PF_idx += 1
        PF = primes[PF_idx]
    if num != 1:
        ans.append(num)
    return ans def findPF(num):
    ans = []
    PF_idx = 0
    PF = primes[PF_idx]
    while PF * PF <= num:
        while num % PF == 0:
            num //= PF
            ans.append(PF)
        PF_idx += 1
        PF = primes[PF_idx]
    if num != 1:
        ans.append(num)
    return ans findPF temp = gcd(a, b) gcd(a, b) temp
primes = []
boo = [True] * (int(1e6) + 1)
boo[0] = False; boo[1] = False
for i in range(2, len(boo)):
    if boo[i]:
        for j in range(i*i, len(boo), i):
            boo[j] = False
        primes.append(i)
        
# Finds the prime factors of a number
def findPF(num):
    ans = []
    PF_idx = 0
    PF = primes[PF_idx]
    while PF * PF <= num:
        while num % PF == 0:
            num //= PF
            ans.append(PF)
        PF_idx += 1
        PF = primes[PF_idx]
    if num != 1:
        ans.append(num)
    return ans

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

a, b = map(int, input().split())
temp = gcd(a, b)
print(len(set(findPF(temp)))+1)
