a,b = map(int,input().split())

if min(a,b) == 1:
    print(1)
    exit()

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

A = factorization(a)
B = factorization(b)
ans = len(set(A) & set(B))
print(ans+1)
 a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b if min(a,b) == 1:
    print(1)
    exit() min(a,b) == 1 min(a,b) min a b 1 print(1) print 1 exit() exit def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            while temp%i==0:
                temp //= i
            arr.append(i)
    if temp!=1:
        arr.append(temp)
    if arr==[]:
        arr.append(n)
    return arr factorization arr = [] arr [] temp = n temp n for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            while temp%i==0:
                temp //= i
            arr.append(i)
     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:
            while temp%i==0:
                temp //= i
            arr.append(i)
     temp%i==0 temp%i temp i 0 while temp%i==0:
                temp //= i
             temp%i==0 temp%i temp i 0 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 = factorization(a) A factorization(a) factorization a B = factorization(b) B factorization(b) factorization b ans = len(set(A) & set(B)) ans len(set(A) & set(B)) len set(A) & set(B) set(A) set A set(B) set B print(ans+1) print ans+1 ans 1 b = map(int,input().split()) map(int,input().split()) b A = factorization(a) factorization(a) A def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            while temp%i==0:
                temp //= i
            arr.append(i)
    if temp!=1:
        arr.append(temp)
    if arr==[]:
        arr.append(n)
    return arr def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            while temp%i==0:
                temp //= i
            arr.append(i)
    if temp!=1:
        arr.append(temp)
    if arr==[]:
        arr.append(n)
    return arr factorization ans = len(set(A) & set(B)) len(set(A) & set(B)) ans a,b = map(int,input().split()) map(int,input().split()) a B = factorization(b) factorization(b) B
a,b = map(int,input().split())

if min(a,b) == 1:
    print(1)
    exit()

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

A = factorization(a)
B = factorization(b)
ans = len(set(A) & set(B))
print(ans+1)

