a,b=map(int,input().split())
if a==1 and b==1:
  print(1)
  exit()
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
ans=0
A=factorization(a)
B=factorization(b)
for i in A:
  for j in B:
    if i[0]==j[0]:
      ans+=1
print(ans+1) a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b if a==1 and b==1:
  print(1)
  exit() a==1 and b==1 a==1 a 1 b==1 b 1 print(1) print 1 exit() exit def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr factorization arr = [] arr [] temp = n temp n for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
     i range(2, int(-(-n**0.5//1))+1) range 2 int(-(-n**0.5//1))+1 int(-(-n**0.5//1)) int -(-n**0.5//1) -n**0.5//1 -n**0.5 n**0.5 n 0.5 1 1 if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
     temp%i==0 temp%i temp i 0 cnt=0 cnt 0 while temp%i==0:
                cnt+=1
                temp //= i
             temp%i==0 temp%i temp i 0 cnt+=1 cnt 1 temp //= i temp i arr.append([i, cnt]) arr.append arr append [i, cnt] i cnt if temp!=1:
        arr.append([temp, 1])
     temp!=1 temp 1 arr.append([temp, 1]) arr.append arr append [temp, 1] temp 1 if arr==[]:
        arr.append([n, 1])
     arr==[] arr [] arr.append([n, 1]) arr.append arr append [n, 1] n 1 return arr arr n n ans=0 ans 0 A=factorization(a) A factorization(a) factorization a B=factorization(b) B factorization(b) factorization b for i in A:
  for j in B:
    if i[0]==j[0]:
      ans+=1 i A for j in B:
    if i[0]==j[0]:
      ans+=1 j B if i[0]==j[0]:
      ans+=1 i[0]==j[0] i[0] i 0 j[0] j 0 ans+=1 ans 1 print(ans+1) print ans+1 ans 1 ans=0 0 ans ans+=1 1 ans b=map(int,input().split()) map(int,input().split()) b def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr factorization a,b=map(int,input().split()) map(int,input().split()) a B=factorization(b) factorization(b) B A=factorization(a) factorization(a) A
a,b=map(int,input().split())
if a==1 and b==1:
  print(1)
  exit()
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
ans=0
A=factorization(a)
B=factorization(b)
for i in A:
  for j in B:
    if i[0]==j[0]:
      ans+=1
print(ans+1)
