#from collections import defaultdict 

import copy

import math

A,B = list(map(int, input().split()))



num = min(A,B)

tmps = {}

p = 2

for p in range(2, math.ceil(num**0.5)+1):



    if A % p == 0 and B % p == 0:

        tmps[p] = True



    if A % (num//p) == 0 and B % (num//p) == 0:

        tmps[num//p] = True



    p += 1



if num != 1 and  A % num == 0 and B % num == 0:

    tmps[num] = True





d = copy.deepcopy(tmps)

for k in list(tmps.keys()):



    if d.get(k, False):

        aaa = copy.deepcopy(d)

        for n in list(d.keys()):

            if k == n:

                continue

            if n > k and n % k == 0:

                aaa.pop(n)

        d = aaa



print((len(list(d.keys()))+1))



A,B = list(map(int, input().split()))









def getPrimeFactorsList(num):

  pn = 2 #素数は2から

  pflist = [] #素因数のリスト

  while pn * pn <= num: #√numまで調べる

    while num % pn == 0: #現在の素数で割り切れる範囲でループ

      num = num / pn

      pflist.append(pn)

    pn += 1 #割り切れなくなったら次の素数へ

  if num > 1:

    pflist.append(int(num))

    

  return pflist



pf_A = getPrimeFactorsList(A)

pf_B = getPrimeFactorsList(B)

ans = len(set(pf_A) & set(pf_B)) + 1

print(ans)
# from collections import defaultdict
import copy
import math

A, B = list(map(int, input().split()))
num = min(A, B)
tmps = {}
p = 2
for p in range(2, math.ceil(num**0.5) + 1):
    if A % p == 0 and B % p == 0:
        tmps[p] = True
    if A % (num // p) == 0 and B % (num // p) == 0:
        tmps[num // p] = True
    p += 1
if num != 1 and A % num == 0 and B % num == 0:
    tmps[num] = True
d = copy.deepcopy(tmps)
for k in list(tmps.keys()):
    if d.get(k, False):
        aaa = copy.deepcopy(d)
        for n in list(d.keys()):
            if k == n:
                continue
            if n > k and n % k == 0:
                aaa.pop(n)
        d = aaa
print((len(list(d.keys())) + 1))

A, B = list(map(int, input().split()))


def getPrimeFactorsList(num):
    pn = 2  # 素数は2から
    pflist = []  # 素因数のリスト
    while pn * pn <= num:  # √numまで調べる
        while num % pn == 0:  # 現在の素数で割り切れる範囲でループ
            num = num / pn
            pflist.append(pn)
        pn += 1  # 割り切れなくなったら次の素数へ
    if num > 1:
        pflist.append(int(num))
    return pflist


pf_A = getPrimeFactorsList(A)
pf_B = getPrimeFactorsList(B)
ans = len(set(pf_A) & set(pf_B)) + 1
print(ans)

-# from collections import defaultdict -import copy -import math +A, B = list(map(int, input().split())) -A, B = list(map(int, input().split())) -num = min(A, B) -tmps = {} -p = 2 -for p in range(2, math.ceil(num**0.5) + 1): -    if A % p == 0 and B % p == 0: -        tmps[p] = True -    if A % (num // p) == 0 and B % (num // p) == 0: -        tmps[num // p] = True -    p += 1 -if num != 1 and A % num == 0 and B % num == 0: -    tmps[num] = True -d = copy.deepcopy(tmps) -for k in list(tmps.keys()): -    if d.get(k, False): -        aaa = copy.deepcopy(d) -        for n in list(d.keys()): -            if k == n: -                continue -            if n > k and n % k == 0: -                aaa.pop(n) -        d = aaa -print((len(list(d.keys())) + 1)) + +def getPrimeFactorsList(num): +    pn = 2  # 素数は2から +    pflist = []  # 素因数のリスト +    while pn * pn <= num:  # √numまで調べる +        while num % pn == 0:  # 現在の素数で割り切れる範囲でループ +            num = num / pn +            pflist.append(pn) +        pn += 1  # 割り切れなくなったら次の素数へ +    if num > 1: +        pflist.append(int(num)) +    return pflist + + +pf_A = getPrimeFactorsList(A) +pf_B = getPrimeFactorsList(B) +ans = len(set(pf_A) & set(pf_B)) + 1 +print(ans)