import sys

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 main():
    A, B = map(int, input().split())

    pf_A = factorization(A)
    pf_B = factorization(B)

    if pf_A[0][0] == 1 or pf_B[0][0] == 1:
        pfs = []
    else:
        pfs = set([i for i,num in pf_A]) & set([i for i,num in pf_B])

    print(len(pfs)+1)
main() import sys sys 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 = [] arr [] temp = n 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 def main():
    A, B = map(int, input().split())

    pf_A = factorization(A)
    pf_B = factorization(B)

    if pf_A[0][0] == 1 or pf_B[0][0] == 1:
        pfs = []
    else:
        pfs = set([i for i,num in pf_A]) & set([i for i,num in pf_B])

    print(len(pfs)+1) main A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B pf_A = factorization(A) pf_A factorization(A) factorization A pf_B = factorization(B) pf_B factorization(B) factorization B if pf_A[0][0] == 1 or pf_B[0][0] == 1:
        pfs = []
    else:
        pfs = set([i for i,num in pf_A]) & set([i for i,num in pf_B])

     pf_A[0][0] == 1 or pf_B[0][0] == 1 pf_A[0][0] == 1 pf_A[0][0] [0] pf_A 0 0 1 pf_B[0][0] == 1 pf_B[0][0] [0] pf_B 0 0 1 pfs = [] pfs [] i for i,num in pf_A for i,num in pf_A i num pf_A for i,num in pf_A i pfs = set([i for i,num in pf_A]) & set([i for i,num in pf_B]) pfs set([i for i,num in pf_A]) & set([i for i,num in pf_B]) set([i for i,num in pf_A]) set [i for i,num in pf_A] set([i for i,num in pf_B]) set [i for i,num in pf_B] print(len(pfs)+1) print len(pfs)+1 len(pfs) len pfs 1 main() main def main():
    A, B = map(int, input().split())

    pf_A = factorization(A)
    pf_B = factorization(B)

    if pf_A[0][0] == 1 or pf_B[0][0] == 1:
        pfs = []
    else:
        pfs = set([i for i,num in pf_A]) & set([i for i,num in pf_B])

    print(len(pfs)+1) def main():
    A, B = map(int, input().split())

    pf_A = factorization(A)
    pf_B = factorization(B)

    if pf_A[0][0] == 1 or pf_B[0][0] == 1:
        pfs = []
    else:
        pfs = set([i for i,num in pf_A]) & set([i for i,num in pf_B])

    print(len(pfs)+1) main 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
import sys

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 main():
    A, B = map(int, input().split())

    pf_A = factorization(A)
    pf_B = factorization(B)

    if pf_A[0][0] == 1 or pf_B[0][0] == 1:
        pfs = []
    else:
        pfs = set([i for i,num in pf_A]) & set([i for i,num in pf_B])

    print(len(pfs)+1)
main()