import sys
input=sys.stdin.readline
import math

A,B = (int(x) for x in input().rstrip('\n').split())
c = math.gcd(A,B)
if c==1:
  print(1)
else:
  ps=[]
  d = math.floor(math.sqrt(c))
  for i in range(2,d+2):
    if c%i==0:
      if all(i%x!=0 for x in ps):
        ps.append(i)
        while c % i ==0:
          c = c//i
  if c > 1:
    ps.append(0)
  print(len(ps)+1) import sys sys input=sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline import math math int(x) for x in input().rstrip('\n').split() for x in input().rstrip('\n').split() x input().rstrip('\n').split() ().rstrip('\n').split ().rstrip('\n') ().rstrip () input rstrip '\n' split for x in input().rstrip('\n').split() int(x) int x A,B = (int(x) for x in input().rstrip('\n').split()) A (int(x) for x in input().rstrip('\n').split()) B c = math.gcd(A,B) c math.gcd(A,B) math.gcd math gcd A B if c==1:
  print(1)
else:
  ps=[]
  d = math.floor(math.sqrt(c))
  for i in range(2,d+2):
    if c%i==0:
      if all(i%x!=0 for x in ps):
        ps.append(i)
        while c % i ==0:
          c = c//i
  if c > 1:
    ps.append(0)
  print(len(ps)+1) c==1 c 1 print(1) print 1 ps=[] ps [] d = math.floor(math.sqrt(c)) d math.floor(math.sqrt(c)) math.floor math floor math.sqrt(c) math.sqrt math sqrt c for i in range(2,d+2):
    if c%i==0:
      if all(i%x!=0 for x in ps):
        ps.append(i)
        while c % i ==0:
          c = c//i
   i range(2,d+2) range 2 d+2 d 2 if c%i==0:
      if all(i%x!=0 for x in ps):
        ps.append(i)
        while c % i ==0:
          c = c//i
   c%i==0 c%i c i 0 if all(i%x!=0 for x in ps):
        ps.append(i)
        while c % i ==0:
          c = c//i
   all(i%x!=0 for x in ps) all i%x!=0 i%x i x 0 ps.append(i) ps.append ps append i while c % i ==0:
          c = c//i
   c % i ==0 c % i c i 0 c = c//i c c//i c i if c > 1:
    ps.append(0)
   c > 1 c 1 ps.append(0) ps.append ps append 0 print(len(ps)+1) print len(ps)+1 len(ps) len ps 1 c = c//i c//i c A,B = (int(x) for x in input().rstrip('\n').split()) (int(x) for x in input().rstrip('\n').split()) A B = (int(x) for x in input().rstrip('\n').split()) (int(x) for x in input().rstrip('\n').split()) B c = math.gcd(A,B) math.gcd(A,B) c ps=[] [] ps input=sys.stdin.readline sys.stdin.readline input d = math.floor(math.sqrt(c)) math.floor(math.sqrt(c)) d
import sys
input=sys.stdin.readline
import math

A,B = (int(x) for x in input().rstrip('\n').split())
c = math.gcd(A,B)
if c==1:
  print(1)
else:
  ps=[]
  d = math.floor(math.sqrt(c))
  for i in range(2,d+2):
    if c%i==0:
      if all(i%x!=0 for x in ps):
        ps.append(i)
        while c % i ==0:
          c = c//i
  if c > 1:
    ps.append(0)
  print(len(ps)+1)