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

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

ans=len(factorization(math.gcd(a,b)))
print(ans+1 if math.gcd(a,b)!=1 else 1) import math math a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b def factorization(n):
    arr=[]
    tmp=n
    for i in range(2,int(n**0.5)+1):
        while tmp%i==0:
            tmp//=i
            arr.append(i)
    if tmp!=1:
        arr.append(tmp)
    if arr==[]:
        arr.append(n)
    return list(set(arr)) factorization arr=[] arr [] tmp=n tmp n for i in range(2,int(n**0.5)+1):
        while tmp%i==0:
            tmp//=i
            arr.append(i)
     i range(2,int(n**0.5)+1) range 2 int(n**0.5)+1 int(n**0.5) int n**0.5 n 0.5 1 while tmp%i==0:
            tmp//=i
            arr.append(i)
     tmp%i==0 tmp%i tmp i 0 tmp//=i tmp i arr.append(i) arr.append arr append i if tmp!=1:
        arr.append(tmp)
     tmp!=1 tmp 1 arr.append(tmp) arr.append arr append tmp if arr==[]:
        arr.append(n)
     arr==[] arr [] arr.append(n) arr.append arr append n return list(set(arr)) list(set(arr)) list set(arr) set arr n n ans=len(factorization(math.gcd(a,b))) ans len(factorization(math.gcd(a,b))) len factorization(math.gcd(a,b)) factorization math.gcd(a,b) math.gcd math gcd a b print(ans+1 if math.gcd(a,b)!=1 else 1) print ans+1 if math.gcd(a,b)!=1 else 1 math.gcd(a,b)!=1 math.gcd(a,b) math.gcd math gcd a b 1 ans+1 ans 1 1 ans=len(factorization(math.gcd(a,b))) len(factorization(math.gcd(a,b))) ans b=map(int,input().split()) map(int,input().split()) b a,b=map(int,input().split()) map(int,input().split()) a def factorization(n):
    arr=[]
    tmp=n
    for i in range(2,int(n**0.5)+1):
        while tmp%i==0:
            tmp//=i
            arr.append(i)
    if tmp!=1:
        arr.append(tmp)
    if arr==[]:
        arr.append(n)
    return list(set(arr)) def factorization(n):
    arr=[]
    tmp=n
    for i in range(2,int(n**0.5)+1):
        while tmp%i==0:
            tmp//=i
            arr.append(i)
    if tmp!=1:
        arr.append(tmp)
    if arr==[]:
        arr.append(n)
    return list(set(arr)) factorization
import math
a,b=map(int,input().split())

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

ans=len(factorization(math.gcd(a,b)))
print(ans+1 if math.gcd(a,b)!=1 else 1)