a,b=map(int,input().split())

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

g=gcd(a,b)

f=set()
for i in range(1,int(g**0.5)+1):
  if g%i==0:
    for j in range(2,int(i**0.5)+1):
      if i%j==0:
        break
    else:
      f.add(i)
    p=g//i
    for j in range(2,int(p**0.5)+1):
      if p%j==0:
        break
    else:
      f.add(p)

print(len(f)) a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b def gcd(a,b):
  if a<b:
    a,b=b,a
  while a%b:
    a,b=b,a%b
  return b gcd if a<b:
    a,b=b,a
   a<b a b a,b=b,a a b b a while a%b:
    a,b=b,a%b
   a%b a b a,b=b,a%b a b b a%b a b return b b a a b b g=gcd(a,b) g gcd(a,b) gcd a b f=set() f set() set for i in range(1,int(g**0.5)+1):
  if g%i==0:
    for j in range(2,int(i**0.5)+1):
      if i%j==0:
        break
    else:
      f.add(i)
    p=g//i
    for j in range(2,int(p**0.5)+1):
      if p%j==0:
        break
    else:
      f.add(p) i range(1,int(g**0.5)+1) range 1 int(g**0.5)+1 int(g**0.5) int g**0.5 g 0.5 1 if g%i==0:
    for j in range(2,int(i**0.5)+1):
      if i%j==0:
        break
    else:
      f.add(i)
    p=g//i
    for j in range(2,int(p**0.5)+1):
      if p%j==0:
        break
    else:
      f.add(p) g%i==0 g%i g i 0 for j in range(2,int(i**0.5)+1):
      if i%j==0:
        break
    else:
      f.add(i)
     j range(2,int(i**0.5)+1) range 2 int(i**0.5)+1 int(i**0.5) int i**0.5 i 0.5 1 if i%j==0:
        break
     i%j==0 i%j i j 0 break f.add(i) f.add f add i p=g//i p g//i g i for j in range(2,int(p**0.5)+1):
      if p%j==0:
        break
    else:
      f.add(p) j range(2,int(p**0.5)+1) range 2 int(p**0.5)+1 int(p**0.5) int p**0.5 p 0.5 1 if p%j==0:
        break
     p%j==0 p%j p j 0 break f.add(p) f.add f add p print(len(f)) print len(f) len f p=g//i g//i p def gcd(a,b):
  if a<b:
    a,b=b,a
  while a%b:
    a,b=b,a%b
  return b def gcd(a,b):
  if a<b:
    a,b=b,a
  while a%b:
    a,b=b,a%b
  return b gcd g=gcd(a,b) gcd(a,b) g b=map(int,input().split()) map(int,input().split()) b a,b=map(int,input().split()) map(int,input().split()) a f=set() set() f
a,b=map(int,input().split())

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

g=gcd(a,b)

f=set()
for i in range(1,int(g**0.5)+1):
  if g%i==0:
    for j in range(2,int(i**0.5)+1):
      if i%j==0:
        break
    else:
      f.add(i)
    p=g//i
    for j in range(2,int(p**0.5)+1):
      if p%j==0:
        break
    else:
      f.add(p)

print(len(f))