a, b = map(int, input().split())
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])
    return arr
c = factorization(a)
d = factorization(b)
cnt = 1
for i,j in c:
  for k,l in d:
    if i == k:
      cnt += 1
print(cnt) a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () 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])
    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 return arr arr n n c = factorization(a) c factorization(a) factorization a d = factorization(b) d factorization(b) factorization b cnt = 1 cnt 1 for i,j in c:
  for k,l in d:
    if i == k:
      cnt += 1 i j c for k,l in d:
    if i == k:
      cnt += 1 k l d if i == k:
      cnt += 1 i == k i k cnt += 1 cnt 1 print(cnt) print cnt 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])
    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])
    return arr factorization cnt = 1 1 cnt d = factorization(b) factorization(b) d cnt += 1 1 cnt a, b = map(int, input().split()) map(int, input().split()) a c = factorization(a) factorization(a) c
a, b = map(int, input().split())
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])
    return arr
c = factorization(a)
d = factorization(b)
cnt = 1
for i,j in c:
  for k,l in d:
    if i == k:
      cnt += 1
print(cnt)