from fractions import gcd

A,B = map(int,input().split())
C = gcd(A,B)
nse = set()

for i in range(1,int(C**0.5+1)):
  if C%i == 0:
    nse.add(i)
    nse.add(C//i)
    
nli = list(nse)
nli.sort()
size = len(nli)

for i in range(1,size):
  n = nli[i]
  for j in range(i+1,size):
    if nli[j]%n == 0 :
      nse.add(nli[j])
      nse.remove(nli[j])

print(len(nse)) from fractions import gcd A,B = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B C = gcd(A,B) C gcd(A,B) gcd A B nse = set() nse set() set for i in range(1,int(C**0.5+1)):
  if C%i == 0:
    nse.add(i)
    nse.add(C//i)
     i range(1,int(C**0.5+1)) range 1 int(C**0.5+1) int C**0.5+1 C**0.5 C 0.5 1 if C%i == 0:
    nse.add(i)
    nse.add(C//i)
     C%i == 0 C%i C i 0 nse.add(i) nse.add nse add i nse.add(C//i) nse.add nse add C//i C i nli = list(nse) nli list(nse) list nse nli.sort() nli.sort nli sort size = len(nli) size len(nli) len nli for i in range(1,size):
  n = nli[i]
  for j in range(i+1,size):
    if nli[j]%n == 0 :
      nse.add(nli[j])
      nse.remove(nli[j]) i range(1,size) range 1 size n = nli[i] n nli[i] nli i for j in range(i+1,size):
    if nli[j]%n == 0 :
      nse.add(nli[j])
      nse.remove(nli[j]) j range(i+1,size) range i+1 i 1 size if nli[j]%n == 0 :
      nse.add(nli[j])
      nse.remove(nli[j]) nli[j]%n == 0 nli[j]%n nli[j] nli j n 0 nse.add(nli[j]) nse.add nse add nli[j] nli j nse.remove(nli[j]) nse.remove nse remove nli[j] nli j print(len(nse)) print len(nse) len nse C = gcd(A,B) gcd(A,B) C nse = set() set() nse n = nli[i] nli[i] n B = map(int,input().split()) map(int,input().split()) B nli = list(nse) list(nse) nli A,B = map(int,input().split()) map(int,input().split()) A size = len(nli) len(nli) size
from fractions import gcd

A,B = map(int,input().split())
C = gcd(A,B)
nse = set()

for i in range(1,int(C**0.5+1)):
  if C%i == 0:
    nse.add(i)
    nse.add(C//i)
    
nli = list(nse)
nli.sort()
size = len(nli)

for i in range(1,size):
  n = nli[i]
  for j in range(i+1,size):
    if nli[j]%n == 0 :
      nse.add(nli[j])
      nse.remove(nli[j])

print(len(nse))