from math import gcd


def factorization(n):
    arr, temp = [], n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr


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

fac = factorization(n_gcd)
ans = 0
if fac[0][0] != 1:
    ans += 1

ans += len(fac)
print(ans) from math import gcd def factorization(n):
    arr, temp = [], n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr factorization arr, temp = [], n arr [] temp n for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
     i range(2, int(-(-n**0.5//1))+1) range 2 int(-(-n**0.5//1))+1 int(-(-n**0.5//1)) int -(-n**0.5//1) -n**0.5//1 -n**0.5 n**0.5 n 0.5 1 1 if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
     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, cnt]) arr.append arr append [i, cnt] i cnt if temp!=1:
        arr.append([temp, 1])
     temp!=1 temp 1 arr.append([temp, 1]) arr.append arr append [temp, 1] temp 1 if arr==[]:
        arr.append([n, 1])
     arr==[] arr [] arr.append([n, 1]) arr.append arr append [n, 1] n 1 return arr arr n n A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B n_gcd = gcd(A, B) n_gcd gcd(A, B) gcd A B fac = factorization(n_gcd) fac factorization(n_gcd) factorization n_gcd ans = 0 ans 0 if fac[0][0] != 1:
    ans += 1 fac[0][0] != 1 fac[0][0] [0] fac 0 0 1 ans += 1 ans 1 ans += len(fac) ans len(fac) len fac print(ans) print ans n_gcd = gcd(A, B) gcd(A, B) n_gcd B = map(int, input().split()) map(int, input().split()) B ans += 1 1 ans A, B = map(int, input().split()) map(int, input().split()) A fac = factorization(n_gcd) factorization(n_gcd) fac ans += len(fac) len(fac) ans def factorization(n):
    arr, temp = [], n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr def factorization(n):
    arr, temp = [], n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr factorization ans = 0 0 ans
from math import gcd


def factorization(n):
    arr, temp = [], n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr


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

fac = factorization(n_gcd)
ans = 0
if fac[0][0] != 1:
    ans += 1

ans += len(fac)
print(ans)