"""
    こんにちは。これはクシャルです
    
    Author : thekushalghosh (クシャル)
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time
start_time = time.time()
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################

def solve():
    a,b = invr()
    print(len(set(prime_factors(math.gcd(a,b)))) + 1)
            
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
        sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------#
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(int,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------#
def counter(a):
    q = [0] * max(a)
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1],1
    return(q)
 
def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97],1
    return(q)

def factors(n):
    q = []
    for i in range(1,int(n ** 0.5) + 1):
        if n % i == 0: q.append(i); q.append(n // i)
    return(list(sorted(list(set(q)))))

def prime_factors(n):
    q = []
    while n % 2 == 0: q.append(2); n = n // 2
    for i in range(3,int(n ** 0.5) + 1,2):
        while n % i == 0: q.append(i); n = n // i
    if n > 2: q.append(n)
    return(list(sorted(q)))

#-----------------------------------------------------------------------#
        
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline
main() """
    こんにちは。これはクシャルです
    
    Author : thekushalghosh (クシャル)
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
""" import sys,math,cmath,time sys math cmath time start_time = time.time() start_time time.time() time.time time time def solve():
    a,b = invr()
    print(len(set(prime_factors(math.gcd(a,b)))) + 1)
            
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
  solve a,b = invr() a invr() invr b print(len(set(prime_factors(math.gcd(a,b)))) + 1) print len(set(prime_factors(math.gcd(a,b)))) + 1 len(set(prime_factors(math.gcd(a,b)))) len set(prime_factors(math.gcd(a,b))) set prime_factors(math.gcd(a,b)) prime_factors math.gcd(a,b) math.gcd math gcd a b 1 def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
        sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------# main global tt if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
     not ONLINE_JUDGE ONLINE_JUDGE sys.stdin = open("input.txt","r") sys.stdin sys stdin open("input.txt","r") open "input.txt" "r" sys.stdout = open("output.txt","w") sys.stdout sys stdout open("output.txt","w") open "output.txt" "w" t = 1 t 1 for tt in range(t):
        solve()
     tt range(t) range t solve() solve if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
        sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------# not ONLINE_JUDGE ONLINE_JUDGE print("Time Elapsed :",time.time() - start_time,"seconds") print "Time Elapsed :" time.time() - start_time time.time() time.time time time start_time "seconds" sys.stdout.close() sys.stdout.close sys.stdout sys stdout close def inp():
    return(int(input())) inp return(int(input())) int(input()) int input() input def inlt():
    return(list(map(int,input().split()))) inlt return(list(map(int,input().split()))) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split def insr():
    return(input().strip()) insr return(input().strip()) input().strip() ().strip () input strip def invr():
    return(map(int,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------# invr return(map(int,input().split())) map(int,input().split()) map int input().split() ().split () input split def counter(a):
    q = [0] * max(a)
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1],1
    return(q)
  counter q = [0] * max(a) q [0] * max(a) [0] 0 max(a) max a for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1],1
     i range(len(a)) range len(a) len a q[a[i] - 1] = q[a[i] - 1],1 q[a[i] - 1] q a[i] - 1 a[i] a i 1 q[a[i] - 1] = q[a[i] - 1],1 q[a[i] - 1] q a[i] - 1 a[i] a i 1 1 return(q) q a a def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97],1
    return(q) string_counter q = [0] * 26 q [0] * 26 [0] 0 26 for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97],1
     i range(len(a)) range len(a) len a q[ord(a[i]) - 97] = q[ord(a[i]) - 97],1 q[ord(a[i]) - 97] q ord(a[i]) - 97 ord(a[i]) ord a[i] a i 97 q[ord(a[i]) - 97] = q[ord(a[i]) - 97],1 q[ord(a[i]) - 97] q ord(a[i]) - 97 ord(a[i]) ord a[i] a i 97 1 return(q) q a a def factors(n):
    q = []
    for i in range(1,int(n ** 0.5) + 1):
        if n % i == 0: q.append(i); q.append(n // i)
    return(list(sorted(list(set(q))))) factors q = [] q [] for i in range(1,int(n ** 0.5) + 1):
        if n % i == 0: q.append(i); q.append(n // i)
     i range(1,int(n ** 0.5) + 1) range 1 int(n ** 0.5) + 1 int(n ** 0.5) int n ** 0.5 n 0.5 1 if n % i == 0: q.append(i); q.append(n // i)
     n % i == 0 n % i n i 0 return(list(sorted(list(set(q))))) list(sorted(list(set(q)))) list sorted(list(set(q))) sorted list(set(q)) list set(q) set q n n def prime_factors(n):
    q = []
    while n % 2 == 0: q.append(2); n = n // 2
    for i in range(3,int(n ** 0.5) + 1,2):
        while n % i == 0: q.append(i); n = n // i
    if n > 2: q.append(n)
    return(list(sorted(q)))

#-----------------------------------------------------------------------#
         prime_factors q = [] q [] while n % 2 == 0: q.append(2); n = n // 2
     n % 2 == 0 n % 2 n 2 0 for i in range(3,int(n ** 0.5) + 1,2):
        while n % i == 0: q.append(i); n = n // i
     i range(3,int(n ** 0.5) + 1,2) range 3 int(n ** 0.5) + 1 int(n ** 0.5) int n ** 0.5 n 0.5 1 2 while n % i == 0: q.append(i); n = n // i
     n % i == 0 n % i n i 0 if n > 2: q.append(n)
     n > 2 n 2 return(list(sorted(q))) list(sorted(q)) list sorted(q) sorted q n n ONLINE_JUDGE = __debug__ ONLINE_JUDGE __debug__ if ONLINE_JUDGE:
    input = sys.stdin.readline ONLINE_JUDGE input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline main() main def inlt():
    return(list(map(int,input().split()))) def inlt():
    return(list(map(int,input().split()))) inlt input = sys.stdin.readline sys.stdin.readline input def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
        sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------# def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
        sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------# main start_time = time.time() time.time() start_time def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97],1
    return(q) def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97],1
    return(q) string_counter def insr():
    return(input().strip()) def insr():
    return(input().strip()) insr def invr():
    return(map(int,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------# def invr():
    return(map(int,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------# invr def solve():
    a,b = invr()
    print(len(set(prime_factors(math.gcd(a,b)))) + 1)
            
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
  def solve():
    a,b = invr()
    print(len(set(prime_factors(math.gcd(a,b)))) + 1)
            
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
  solve def counter(a):
    q = [0] * max(a)
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1],1
    return(q)
  def counter(a):
    q = [0] * max(a)
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1],1
    return(q)
  counter def inp():
    return(int(input())) def inp():
    return(int(input())) inp def factors(n):
    q = []
    for i in range(1,int(n ** 0.5) + 1):
        if n % i == 0: q.append(i); q.append(n // i)
    return(list(sorted(list(set(q))))) def factors(n):
    q = []
    for i in range(1,int(n ** 0.5) + 1):
        if n % i == 0: q.append(i); q.append(n // i)
    return(list(sorted(list(set(q))))) factors ONLINE_JUDGE = __debug__ __debug__ ONLINE_JUDGE def prime_factors(n):
    q = []
    while n % 2 == 0: q.append(2); n = n // 2
    for i in range(3,int(n ** 0.5) + 1,2):
        while n % i == 0: q.append(i); n = n // i
    if n > 2: q.append(n)
    return(list(sorted(q)))

#-----------------------------------------------------------------------#
         def prime_factors(n):
    q = []
    while n % 2 == 0: q.append(2); n = n // 2
    for i in range(3,int(n ** 0.5) + 1,2):
        while n % i == 0: q.append(i); n = n // i
    if n > 2: q.append(n)
    return(list(sorted(q)))

#-----------------------------------------------------------------------#
         prime_factors
"""
    こんにちは。これはクシャルです
    
    Author : thekushalghosh (クシャル)
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time
start_time = time.time()
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################

def solve():
    a,b = invr()
    print(len(set(prime_factors(math.gcd(a,b)))) + 1)
            
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
        sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------#
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(int,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------#
def counter(a):
    q = [0] * max(a)
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1],1
    return(q)
 
def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97],1
    return(q)

def factors(n):
    q = []
    for i in range(1,int(n ** 0.5) + 1):
        if n % i == 0: q.append(i); q.append(n // i)
    return(list(sorted(list(set(q)))))

def prime_factors(n):
    q = []
    while n % 2 == 0: q.append(2); n = n // 2
    for i in range(3,int(n ** 0.5) + 1,2):
        while n % i == 0: q.append(i); n = n // i
    if n > 2: q.append(n)
    return(list(sorted(q)))

#-----------------------------------------------------------------------#
        
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline
main()