# -*- coding: utf-8 -*-
"""
Created on Wed Jun  3 14:11:35 2020

@author: NEC-PCuser
"""
def gcd(a, b):
    
    if (a % b == 0):
        return b
    return gcd(b, a % b)

def factorize(num):
    i = 2
    factorize_list = []
    num_tmp = num
    while i * i <= num_tmp:
        count = 0
        if num % i == 0:
            while num % i == 0:
                count += 1
                num //= i
            factorize_list.append([i, count])
        i += 1
    if num != 1:
        factorize_list.append([num, 1])
    return factorize_list 
                


if __name__ == "__main__":
    A, B =  map(int, input().split())
    big_num = max(A, B)
    short_num = min(A, B)
    gcd_num = gcd(big_num, short_num)
    print(len(factorize(gcd_num)) + 1)
             """
Created on Wed Jun  3 14:11:35 2020

@author: NEC-PCuser
""" def gcd(a, b):
    
    if (a % b == 0):
        return b
    return gcd(b, a % b) gcd if (a % b == 0):
        return b
     a % b == 0 a % b a b 0 return b b return gcd(b, a % b) gcd(b, a % b) gcd b a % b a b a a b b def factorize(num):
    i = 2
    factorize_list = []
    num_tmp = num
    while i * i <= num_tmp:
        count = 0
        if num % i == 0:
            while num % i == 0:
                count += 1
                num //= i
            factorize_list.append([i, count])
        i += 1
    if num != 1:
        factorize_list.append([num, 1])
    return factorize_list 
                 factorize i = 2 i 2 factorize_list = [] factorize_list [] num_tmp = num num_tmp num while i * i <= num_tmp:
        count = 0
        if num % i == 0:
            while num % i == 0:
                count += 1
                num //= i
            factorize_list.append([i, count])
        i += 1
     i * i <= num_tmp i * i i i num_tmp count = 0 count 0 if num % i == 0:
            while num % i == 0:
                count += 1
                num //= i
            factorize_list.append([i, count])
         num % i == 0 num % i num i 0 while num % i == 0:
                count += 1
                num //= i
             num % i == 0 num % i num i 0 count += 1 count 1 num //= i num i factorize_list.append([i, count]) factorize_list.append factorize_list append [i, count] i count i += 1 i 1 if num != 1:
        factorize_list.append([num, 1])
     num != 1 num 1 factorize_list.append([num, 1]) factorize_list.append factorize_list append [num, 1] num 1 return factorize_list factorize_list num num if __name__ == "__main__":
    A, B =  map(int, input().split())
    big_num = max(A, B)
    short_num = min(A, B)
    gcd_num = gcd(big_num, short_num)
    print(len(factorize(gcd_num)) + 1)
             __name__ == "__main__" __name__ "__main__" A, B =  map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B big_num = max(A, B) big_num max(A, B) max A B short_num = min(A, B) short_num min(A, B) min A B gcd_num = gcd(big_num, short_num) gcd_num gcd(big_num, short_num) gcd big_num short_num print(len(factorize(gcd_num)) + 1) print len(factorize(gcd_num)) + 1 len(factorize(gcd_num)) len factorize(gcd_num) factorize gcd_num 1 A, B =  map(int, input().split()) map(int, input().split()) A big_num = max(A, B) max(A, B) big_num short_num = min(A, B) min(A, B) short_num def gcd(a, b):
    
    if (a % b == 0):
        return b
    return gcd(b, a % b) def gcd(a, b):
    
    if (a % b == 0):
        return b
    return gcd(b, a % b) gcd B =  map(int, input().split()) map(int, input().split()) B gcd_num = gcd(big_num, short_num) gcd(big_num, short_num) gcd_num def factorize(num):
    i = 2
    factorize_list = []
    num_tmp = num
    while i * i <= num_tmp:
        count = 0
        if num % i == 0:
            while num % i == 0:
                count += 1
                num //= i
            factorize_list.append([i, count])
        i += 1
    if num != 1:
        factorize_list.append([num, 1])
    return factorize_list 
                 def factorize(num):
    i = 2
    factorize_list = []
    num_tmp = num
    while i * i <= num_tmp:
        count = 0
        if num % i == 0:
            while num % i == 0:
                count += 1
                num //= i
            factorize_list.append([i, count])
        i += 1
    if num != 1:
        factorize_list.append([num, 1])
    return factorize_list 
                 factorize
# -*- coding: utf-8 -*-
"""
Created on Wed Jun  3 14:11:35 2020

@author: NEC-PCuser
"""
def gcd(a, b):
    
    if (a % b == 0):
        return b
    return gcd(b, a % b)

def factorize(num):
    i = 2
    factorize_list = []
    num_tmp = num
    while i * i <= num_tmp:
        count = 0
        if num % i == 0:
            while num % i == 0:
                count += 1
                num //= i
            factorize_list.append([i, count])
        i += 1
    if num != 1:
        factorize_list.append([num, 1])
    return factorize_list 
                


if __name__ == "__main__":
    A, B =  map(int, input().split())
    big_num = max(A, B)
    short_num = min(A, B)
    gcd_num = gcd(big_num, short_num)
    print(len(factorize(gcd_num)) + 1)
            
