import math 
def using_sqrt(k):  
    factor = 0
        
    # 2以外の偶数は素数ではないので無視する
    if k % 2 == 0 and k != 2:
        return False
        
    # 繰り返しの上限を対象の平方根にする
    for divisor in range(2, math.floor(math.sqrt(k))+1):
        if k % divisor == 0:
            factor += 1
                
    if factor == 0:
        return True
    else:
        return False
            
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

def make_codivisors(n):
    divisors = []
    n0divisors = make_divisors(n[0])
    n0len = len(n0divisors)
    for i in n0divisors:
        for j in range(1, len(n)):
            if n[j] % i != 0:
                break
            if j == len(n)-1:
                divisors.append(i)
            
    # divisors.sort()
    return divisors

a, b =map(int, input().split())
div = make_codivisors([a, b])
ans = 0
for i in div:
  if i==1:
    ans+=1
  else:
    if using_sqrt(i):
      ans+=1
print(ans) import math math def using_sqrt(k):  
    factor = 0
        
    # 2以外の偶数は素数ではないので無視する
    if k % 2 == 0 and k != 2:
        return False
        
    # 繰り返しの上限を対象の平方根にする
    for divisor in range(2, math.floor(math.sqrt(k))+1):
        if k % divisor == 0:
            factor += 1
                
    if factor == 0:
        return True
    else:
        return False
             using_sqrt factor = 0 factor 0 if k % 2 == 0 and k != 2:
        return False
        
    # 繰り返しの上限を対象の平方根にする
     k % 2 == 0 and k != 2 k % 2 == 0 k % 2 k 2 0 k != 2 k 2 return False False for divisor in range(2, math.floor(math.sqrt(k))+1):
        if k % divisor == 0:
            factor += 1
                
     divisor range(2, math.floor(math.sqrt(k))+1) range 2 math.floor(math.sqrt(k))+1 math.floor(math.sqrt(k)) math.floor math floor math.sqrt(k) math.sqrt math sqrt k 1 if k % divisor == 0:
            factor += 1
                
     k % divisor == 0 k % divisor k divisor 0 factor += 1 factor 1 if factor == 0:
        return True
    else:
        return False
             factor == 0 factor 0 return True True return False False k k def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors make_divisors divisors = [] divisors [] for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.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:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

     n % i == 0 n % i n i 0 divisors.append(i) divisors.append divisors append i if i != n // i:
                divisors.append(n//i)

     i != n // i i n // i n i divisors.append(n//i) divisors.append divisors append n//i n i divisors.sort() divisors.sort divisors sort return divisors divisors n n def make_codivisors(n):
    divisors = []
    n0divisors = make_divisors(n[0])
    n0len = len(n0divisors)
    for i in n0divisors:
        for j in range(1, len(n)):
            if n[j] % i != 0:
                break
            if j == len(n)-1:
                divisors.append(i)
            
    # divisors.sort()
    return divisors make_codivisors divisors = [] divisors [] n0divisors = make_divisors(n[0]) n0divisors make_divisors(n[0]) make_divisors n[0] n 0 n0len = len(n0divisors) n0len len(n0divisors) len n0divisors for i in n0divisors:
        for j in range(1, len(n)):
            if n[j] % i != 0:
                break
            if j == len(n)-1:
                divisors.append(i)
            
    # divisors.sort()
     i n0divisors for j in range(1, len(n)):
            if n[j] % i != 0:
                break
            if j == len(n)-1:
                divisors.append(i)
            
    # divisors.sort()
     j range(1, len(n)) range 1 len(n) len n if n[j] % i != 0:
                break
             n[j] % i != 0 n[j] % i n[j] n j i 0 break if j == len(n)-1:
                divisors.append(i)
            
    # divisors.sort()
     j == len(n)-1 j len(n)-1 len(n) len n 1 divisors.append(i) divisors.append divisors append i return divisors divisors n n a, b =map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b div = make_codivisors([a, b]) div make_codivisors([a, b]) make_codivisors [a, b] a b ans = 0 ans 0 for i in div:
  if i==1:
    ans+=1
  else:
    if using_sqrt(i):
      ans+=1 i div if i==1:
    ans+=1
  else:
    if using_sqrt(i):
      ans+=1 i==1 i 1 ans+=1 ans 1 if using_sqrt(i):
      ans+=1 using_sqrt(i) using_sqrt i ans+=1 ans 1 print(ans) print ans ans+=1 1 ans ans = 0 0 ans def make_codivisors(n):
    divisors = []
    n0divisors = make_divisors(n[0])
    n0len = len(n0divisors)
    for i in n0divisors:
        for j in range(1, len(n)):
            if n[j] % i != 0:
                break
            if j == len(n)-1:
                divisors.append(i)
            
    # divisors.sort()
    return divisors def make_codivisors(n):
    divisors = []
    n0divisors = make_divisors(n[0])
    n0len = len(n0divisors)
    for i in n0divisors:
        for j in range(1, len(n)):
            if n[j] % i != 0:
                break
            if j == len(n)-1:
                divisors.append(i)
            
    # divisors.sort()
    return divisors make_codivisors a, b =map(int, input().split()) map(int, input().split()) a def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors make_divisors div = make_codivisors([a, b]) make_codivisors([a, b]) div def using_sqrt(k):  
    factor = 0
        
    # 2以外の偶数は素数ではないので無視する
    if k % 2 == 0 and k != 2:
        return False
        
    # 繰り返しの上限を対象の平方根にする
    for divisor in range(2, math.floor(math.sqrt(k))+1):
        if k % divisor == 0:
            factor += 1
                
    if factor == 0:
        return True
    else:
        return False
             def using_sqrt(k):  
    factor = 0
        
    # 2以外の偶数は素数ではないので無視する
    if k % 2 == 0 and k != 2:
        return False
        
    # 繰り返しの上限を対象の平方根にする
    for divisor in range(2, math.floor(math.sqrt(k))+1):
        if k % divisor == 0:
            factor += 1
                
    if factor == 0:
        return True
    else:
        return False
             using_sqrt b =map(int, input().split()) map(int, input().split()) b ans+=1 1 ans
import math 
def using_sqrt(k):  
    factor = 0
        
    # 2以外の偶数は素数ではないので無視する
    if k % 2 == 0 and k != 2:
        return False
        
    # 繰り返しの上限を対象の平方根にする
    for divisor in range(2, math.floor(math.sqrt(k))+1):
        if k % divisor == 0:
            factor += 1
                
    if factor == 0:
        return True
    else:
        return False
            
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

def make_codivisors(n):
    divisors = []
    n0divisors = make_divisors(n[0])
    n0len = len(n0divisors)
    for i in n0divisors:
        for j in range(1, len(n)):
            if n[j] % i != 0:
                break
            if j == len(n)-1:
                divisors.append(i)
            
    # divisors.sort()
    return divisors

a, b =map(int, input().split())
div = make_codivisors([a, b])
ans = 0
for i in div:
  if i==1:
    ans+=1
  else:
    if using_sqrt(i):
      ans+=1
print(ans)