import math
def readinput():
    a,b=list(map(int,input().split()))
    return a,b

def myFactorization(n):
    '''nを素因数分解する

    戻り値: factList = [[prime1, exp1], [prime2, exp2],...] 
           n=(prime1)**exp1 * (prime2)**exp2 * ...
    '''

    factList=[]
    temp=n
    cnt=0
    while(temp%2==0):
        temp=temp//2
        cnt+=1
    if(cnt>0):
        factList.append([2,cnt])

    m=int(math.sqrt(n))+1
    for i in range(3,m+1,2):
        cnt=0
        while(temp%i==0):
            temp=temp//i
            cnt+=1
        if(cnt>0):
            factList.append([i,cnt])
        if(temp==1):
            break
    if(temp>1):
        factList.append([temp,1])
    return factList

def euclid(x,y):
    if x<y:
        x,y=y,x
    
    while y>0:
        r=x%y
        x=y
        y=r
    return x

def main(a,b):
    gcd=euclid(a,b)
    factList=myFactorization(gcd)
    return len(factList)+1

if __name__=='__main__':
    a,b=readinput()
    ans=main(a,b)
    print(ans) import math math def readinput():
    a,b=list(map(int,input().split()))
    return a,b readinput a,b=list(map(int,input().split())) a list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split b return a,b return a,b a b def myFactorization(n):
    '''nを素因数分解する

    戻り値: factList = [[prime1, exp1], [prime2, exp2],...] 
           n=(prime1)**exp1 * (prime2)**exp2 * ...
    '''

    factList=[]
    temp=n
    cnt=0
    while(temp%2==0):
        temp=temp//2
        cnt+=1
    if(cnt>0):
        factList.append([2,cnt])

    m=int(math.sqrt(n))+1
    for i in range(3,m+1,2):
        cnt=0
        while(temp%i==0):
            temp=temp//i
            cnt+=1
        if(cnt>0):
            factList.append([i,cnt])
        if(temp==1):
            break
    if(temp>1):
        factList.append([temp,1])
    return factList myFactorization '''nを素因数分解する

    戻り値: factList = [[prime1, exp1], [prime2, exp2],...] 
           n=(prime1)**exp1 * (prime2)**exp2 * ...
    ''' factList=[] factList [] temp=n temp n cnt=0 cnt 0 while(temp%2==0):
        temp=temp//2
        cnt+=1
     temp%2==0 temp%2 temp 2 0 temp=temp//2 temp temp//2 temp 2 cnt+=1 cnt 1 if(cnt>0):
        factList.append([2,cnt])

     cnt>0 cnt 0 factList.append([2,cnt]) factList.append factList append [2,cnt] 2 cnt m=int(math.sqrt(n))+1 m int(math.sqrt(n))+1 int(math.sqrt(n)) int math.sqrt(n) math.sqrt math sqrt n 1 for i in range(3,m+1,2):
        cnt=0
        while(temp%i==0):
            temp=temp//i
            cnt+=1
        if(cnt>0):
            factList.append([i,cnt])
        if(temp==1):
            break
     i range(3,m+1,2) range 3 m+1 m 1 2 cnt=0 cnt 0 while(temp%i==0):
            temp=temp//i
            cnt+=1
         temp%i==0 temp%i temp i 0 temp=temp//i temp temp//i temp i cnt+=1 cnt 1 if(cnt>0):
            factList.append([i,cnt])
         cnt>0 cnt 0 factList.append([i,cnt]) factList.append factList append [i,cnt] i cnt if(temp==1):
            break
     temp==1 temp 1 break if(temp>1):
        factList.append([temp,1])
     temp>1 temp 1 factList.append([temp,1]) factList.append factList append [temp,1] temp 1 return factList factList n n def euclid(x,y):
    if x<y:
        x,y=y,x
    
    while y>0:
        r=x%y
        x=y
        y=r
    return x euclid if x<y:
        x,y=y,x
    
     x<y x y x,y=y,x x y y x while y>0:
        r=x%y
        x=y
        y=r
     y>0 y 0 r=x%y r x%y x y x=y x y y=r y r return x x x x y y def main(a,b):
    gcd=euclid(a,b)
    factList=myFactorization(gcd)
    return len(factList)+1 main gcd=euclid(a,b) gcd euclid(a,b) euclid a b factList=myFactorization(gcd) factList myFactorization(gcd) myFactorization gcd return len(factList)+1 len(factList)+1 len(factList) len factList 1 a a b b if __name__=='__main__':
    a,b=readinput()
    ans=main(a,b)
    print(ans) __name__=='__main__' __name__ '__main__' a,b=readinput() a readinput() readinput b ans=main(a,b) ans main(a,b) main a b print(ans) print ans def euclid(x,y):
    if x<y:
        x,y=y,x
    
    while y>0:
        r=x%y
        x=y
        y=r
    return x def euclid(x,y):
    if x<y:
        x,y=y,x
    
    while y>0:
        r=x%y
        x=y
        y=r
    return x euclid b=readinput() readinput() b def myFactorization(n):
    '''nを素因数分解する

    戻り値: factList = [[prime1, exp1], [prime2, exp2],...] 
           n=(prime1)**exp1 * (prime2)**exp2 * ...
    '''

    factList=[]
    temp=n
    cnt=0
    while(temp%2==0):
        temp=temp//2
        cnt+=1
    if(cnt>0):
        factList.append([2,cnt])

    m=int(math.sqrt(n))+1
    for i in range(3,m+1,2):
        cnt=0
        while(temp%i==0):
            temp=temp//i
            cnt+=1
        if(cnt>0):
            factList.append([i,cnt])
        if(temp==1):
            break
    if(temp>1):
        factList.append([temp,1])
    return factList def myFactorization(n):
    '''nを素因数分解する

    戻り値: factList = [[prime1, exp1], [prime2, exp2],...] 
           n=(prime1)**exp1 * (prime2)**exp2 * ...
    '''

    factList=[]
    temp=n
    cnt=0
    while(temp%2==0):
        temp=temp//2
        cnt+=1
    if(cnt>0):
        factList.append([2,cnt])

    m=int(math.sqrt(n))+1
    for i in range(3,m+1,2):
        cnt=0
        while(temp%i==0):
            temp=temp//i
            cnt+=1
        if(cnt>0):
            factList.append([i,cnt])
        if(temp==1):
            break
    if(temp>1):
        factList.append([temp,1])
    return factList myFactorization ans=main(a,b) main(a,b) ans a,b=readinput() readinput() a def readinput():
    a,b=list(map(int,input().split()))
    return a,b def readinput():
    a,b=list(map(int,input().split()))
    return a,b readinput def main(a,b):
    gcd=euclid(a,b)
    factList=myFactorization(gcd)
    return len(factList)+1 def main(a,b):
    gcd=euclid(a,b)
    factList=myFactorization(gcd)
    return len(factList)+1 main
import math
def readinput():
    a,b=list(map(int,input().split()))
    return a,b

def myFactorization(n):
    '''nを素因数分解する

    戻り値: factList = [[prime1, exp1], [prime2, exp2],...] 
           n=(prime1)**exp1 * (prime2)**exp2 * ...
    '''

    factList=[]
    temp=n
    cnt=0
    while(temp%2==0):
        temp=temp//2
        cnt+=1
    if(cnt>0):
        factList.append([2,cnt])

    m=int(math.sqrt(n))+1
    for i in range(3,m+1,2):
        cnt=0
        while(temp%i==0):
            temp=temp//i
            cnt+=1
        if(cnt>0):
            factList.append([i,cnt])
        if(temp==1):
            break
    if(temp>1):
        factList.append([temp,1])
    return factList

def euclid(x,y):
    if x<y:
        x,y=y,x
    
    while y>0:
        r=x%y
        x=y
        y=r
    return x

def main(a,b):
    gcd=euclid(a,b)
    factList=myFactorization(gcd)
    return len(factList)+1

if __name__=='__main__':
    a,b=readinput()
    ans=main(a,b)
    print(ans)
