#!/usr/bin/env python
# coding: utf-8

# In[18]:


import math


# In[23]:


A,B = map(int, input().split())


# In[24]:


# #nの約数を全て求める
# def divisor(n): 
#     i = 1
#     table = []
#     while i * i <= n:
#         if n%i == 0:
#             table.append(i)
#             table.append(n//i)
#         i += 1
#     table = list(set(table))
#     return table


# In[29]:


# def func():
#     mylist = []
#     tmp = 1
#     if A<=B:
#         for x in divisor(A):
#             if B%x==0 and math.gcd(tmp,x)==1:
#                 mylist.append(x)
#                 tmp *= x
#     else:
#         for x in divisor(B):
#             if A%x==0 and math.gcd(tmp,x)==1:
#                 mylist.append(x)
#                 tmp *= x
# #     print(mylist)
#     print(len(mylist))
# if __name__=="__main__":
#     func()


# In[30]:


gcd=math.gcd(A,B)
m = gcd
pf = {}
for i in range(2, int(m**0.5)+1):
    while m % i == 0:
        pf[i] = pf.get(i, 0)+1
        m //= i
if m > 1:
    pf[m] = 1
print(len(pf)+1)


# In[ ]:



 import math math A,B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B gcd=math.gcd(A,B) gcd math.gcd(A,B) math.gcd math gcd A B m = gcd m gcd pf = {} pf {} for i in range(2, int(m**0.5)+1):
    while m % i == 0:
        pf[i] = pf.get(i, 0)+1
        m //= i i range(2, int(m**0.5)+1) range 2 int(m**0.5)+1 int(m**0.5) int m**0.5 m 0.5 1 while m % i == 0:
        pf[i] = pf.get(i, 0)+1
        m //= i m % i == 0 m % i m i 0 pf[i] = pf.get(i, 0)+1 pf[i] pf i pf.get(i, 0)+1 pf.get(i, 0) pf.get pf get i 0 1 m //= i m i if m > 1:
    pf[m] = 1 m > 1 m 1 pf[m] = 1 pf[m] pf m 1 print(len(pf)+1) print len(pf)+1 len(pf) len pf 1 m //= i i m A,B = map(int, input().split()) map(int, input().split()) A gcd=math.gcd(A,B) math.gcd(A,B) gcd m = gcd gcd m B = map(int, input().split()) map(int, input().split()) B pf = {} {} pf
#!/usr/bin/env python
# coding: utf-8

# In[18]:


import math


# In[23]:


A,B = map(int, input().split())


# In[24]:


# #nの約数を全て求める
# def divisor(n): 
#     i = 1
#     table = []
#     while i * i <= n:
#         if n%i == 0:
#             table.append(i)
#             table.append(n//i)
#         i += 1
#     table = list(set(table))
#     return table


# In[29]:


# def func():
#     mylist = []
#     tmp = 1
#     if A<=B:
#         for x in divisor(A):
#             if B%x==0 and math.gcd(tmp,x)==1:
#                 mylist.append(x)
#                 tmp *= x
#     else:
#         for x in divisor(B):
#             if A%x==0 and math.gcd(tmp,x)==1:
#                 mylist.append(x)
#                 tmp *= x
# #     print(mylist)
#     print(len(mylist))
# if __name__=="__main__":
#     func()


# In[30]:


gcd=math.gcd(A,B)
m = gcd
pf = {}
for i in range(2, int(m**0.5)+1):
    while m % i == 0:
        pf[i] = pf.get(i, 0)+1
        m //= i
if m > 1:
    pf[m] = 1
print(len(pf)+1)


# In[ ]:




