A, B = map(int, input().split())
a = set([])
b = set([])
n = 1
while n**2 <= max(A, B):
  if A%n == 0 and n**2 <= A:
    a.add(n)
    a.add(A//n)
  if B%n == 0 and n**2 <= B:
    b.add(n)
    b.add(B//n)
  n += 1
ab = a & b
ab.discard(1)
ab = list(ab)
answer = 0
for i, n in enumerate(ab):
  prime = True
  for j, m in enumerate(ab):
    if i != j and n%m == 0:
      prime = False
      break
  if prime:
    answer += 1
print(answer+1) A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B a = set([]) a set([]) set [] b = set([]) b set([]) set [] n = 1 n 1 while n**2 <= max(A, B):
  if A%n == 0 and n**2 <= A:
    a.add(n)
    a.add(A//n)
  if B%n == 0 and n**2 <= B:
    b.add(n)
    b.add(B//n)
  n += 1 n**2 <= max(A, B) n**2 n 2 max(A, B) max A B if A%n == 0 and n**2 <= A:
    a.add(n)
    a.add(A//n)
   A%n == 0 and n**2 <= A A%n == 0 A%n A n 0 n**2 <= A n**2 n 2 A a.add(n) a.add a add n a.add(A//n) a.add a add A//n A n if B%n == 0 and n**2 <= B:
    b.add(n)
    b.add(B//n)
   B%n == 0 and n**2 <= B B%n == 0 B%n B n 0 n**2 <= B n**2 n 2 B b.add(n) b.add b add n b.add(B//n) b.add b add B//n B n n += 1 n 1 ab = a & b ab a & b a b ab.discard(1) ab.discard ab discard 1 ab = list(ab) ab list(ab) list ab answer = 0 answer 0 for i, n in enumerate(ab):
  prime = True
  for j, m in enumerate(ab):
    if i != j and n%m == 0:
      prime = False
      break
  if prime:
    answer += 1 i n enumerate(ab) enumerate ab prime = True prime True for j, m in enumerate(ab):
    if i != j and n%m == 0:
      prime = False
      break
   j m enumerate(ab) enumerate ab if i != j and n%m == 0:
      prime = False
      break
   i != j and n%m == 0 i != j i j n%m == 0 n%m n m 0 prime = False prime False break if prime:
    answer += 1 prime answer += 1 answer 1 print(answer+1) print answer+1 answer 1 prime = False False prime answer = 0 0 answer A, B = map(int, input().split()) map(int, input().split()) A b = set([]) set([]) b a = set([]) set([]) a B = map(int, input().split()) map(int, input().split()) B n += 1 1 n n = 1 1 n ab = a & b a & b ab answer += 1 1 answer ab = list(ab) list(ab) ab prime = True True prime
A, B = map(int, input().split())
a = set([])
b = set([])
n = 1
while n**2 <= max(A, B):
  if A%n == 0 and n**2 <= A:
    a.add(n)
    a.add(A//n)
  if B%n == 0 and n**2 <= B:
    b.add(n)
    b.add(B//n)
  n += 1
ab = a & b
ab.discard(1)
ab = list(ab)
answer = 0
for i, n in enumerate(ab):
  prime = True
  for j, m in enumerate(ab):
    if i != j and n%m == 0:
      prime = False
      break
  if prime:
    answer += 1
print(answer+1)
