def factrization(n):
    arr = []
    temp = n
    
    for i in range(2, int(n**0.5//1) + 2):
        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())
ans = 0

la = factrization(a)
lb = factrization(b)

if 1 not in la:
    la.append(1)
if 1 not in lb:
    lb.append(1)

for i in la:
    if i in lb:
        ans += 1

print(ans) def factrization(n):
    arr = []
    temp = n
    
    for i in range(2, int(n**0.5//1) + 2):
        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 factrization arr = [] arr [] temp = n temp n for i in range(2, int(n**0.5//1) + 2):
        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) + 2) range 2 int(n**0.5//1) + 2 int(n**0.5//1) int n**0.5//1 n**0.5 n 0.5 1 2 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 ans = 0 ans 0 la = factrization(a) la factrization(a) factrization a lb = factrization(b) lb factrization(b) factrization b if 1 not in la:
    la.append(1) 1 not in la 1 la la.append(1) la.append la append 1 if 1 not in lb:
    lb.append(1) 1 not in lb 1 lb lb.append(1) lb.append lb append 1 for i in la:
    if i in lb:
        ans += 1 i la if i in lb:
        ans += 1 i in lb i lb ans += 1 ans 1 print(ans) print ans lb = factrization(b) factrization(b) lb ans += 1 1 ans la = factrization(a) factrization(a) la def factrization(n):
    arr = []
    temp = n
    
    for i in range(2, int(n**0.5//1) + 2):
        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 factrization(n):
    arr = []
    temp = n
    
    for i in range(2, int(n**0.5//1) + 2):
        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 factrization a, b = map(int, input().split()) map(int, input().split()) a b = map(int, input().split()) map(int, input().split()) b ans = 0 0 ans
def factrization(n):
    arr = []
    temp = n
    
    for i in range(2, int(n**0.5//1) + 2):
        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())
ans = 0

la = factrization(a)
lb = factrization(b)

if 1 not in la:
    la.append(1)
if 1 not in lb:
    lb.append(1)

for i in la:
    if i in lb:
        ans += 1

print(ans)