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)

    if temp!=1:
        arr.append(temp)

    if arr==[]:
        arr.append(n)

    return arr
  

a,b=map(int,input().split())
al=factorization(a)
bl=factorization(b)

com=set(al) & set(bl)
if a==1 and b==1:
  print(1)
else:
  print(len(com)+1) 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)

    if temp!=1:
        arr.append(temp)

    if arr==[]:
        arr.append(n)

    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)

     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)

     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) arr.append arr append i if temp!=1:
        arr.append(temp)

     temp!=1 temp 1 arr.append(temp) arr.append arr append temp if arr==[]:
        arr.append(n)

     arr==[] arr [] arr.append(n) arr.append arr append n return arr arr n n a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b al=factorization(a) al factorization(a) factorization a bl=factorization(b) bl factorization(b) factorization b com=set(al) & set(bl) com set(al) & set(bl) set(al) set al set(bl) set bl if a==1 and b==1:
  print(1)
else:
  print(len(com)+1) a==1 and b==1 a==1 a 1 b==1 b 1 print(1) print 1 print(len(com)+1) print len(com)+1 len(com) len com 1 b=map(int,input().split()) map(int,input().split()) b al=factorization(a) factorization(a) al 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)

    if temp!=1:
        arr.append(temp)

    if arr==[]:
        arr.append(n)

    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)

    if temp!=1:
        arr.append(temp)

    if arr==[]:
        arr.append(n)

    return arr
   factorization bl=factorization(b) factorization(b) bl a,b=map(int,input().split()) map(int,input().split()) a com=set(al) & set(bl) set(al) & set(bl) com
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)

    if temp!=1:
        arr.append(temp)

    if arr==[]:
        arr.append(n)

    return arr
  

a,b=map(int,input().split())
al=factorization(a)
bl=factorization(b)

com=set(al) & set(bl)
if a==1 and b==1:
  print(1)
else:
  print(len(com)+1)
