from math import gcd

def factorization(N):
    res=[]
    for i in range(2,int(N**(1/2))+2):
        if not N%i:
            r=0
            while not N%i:
                N//=i
                r+=1
            res.append((i,r))
    if N>1:
        res.append((N,1))
    return res
a,b=map(int,input().split())
g=gcd(a,b)
print(1+len(factorization(g))) from math import gcd def factorization(N):
    res=[]
    for i in range(2,int(N**(1/2))+2):
        if not N%i:
            r=0
            while not N%i:
                N//=i
                r+=1
            res.append((i,r))
    if N>1:
        res.append((N,1))
    return res factorization res=[] res [] for i in range(2,int(N**(1/2))+2):
        if not N%i:
            r=0
            while not N%i:
                N//=i
                r+=1
            res.append((i,r))
     i range(2,int(N**(1/2))+2) range 2 int(N**(1/2))+2 int(N**(1/2)) int N**(1/2) N 1/2 1 2 2 if not N%i:
            r=0
            while not N%i:
                N//=i
                r+=1
            res.append((i,r))
     not N%i N%i N i r=0 r 0 while not N%i:
                N//=i
                r+=1
             not N%i N%i N i N//=i N i r+=1 r 1 res.append((i,r)) res.append res append (i,r) i r if N>1:
        res.append((N,1))
     N>1 N 1 res.append((N,1)) res.append res append (N,1) N 1 return res res N N a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b g=gcd(a,b) g gcd(a,b) gcd a b print(1+len(factorization(g))) print 1+len(factorization(g)) 1 len(factorization(g)) len factorization(g) factorization g g=gcd(a,b) gcd(a,b) g def factorization(N):
    res=[]
    for i in range(2,int(N**(1/2))+2):
        if not N%i:
            r=0
            while not N%i:
                N//=i
                r+=1
            res.append((i,r))
    if N>1:
        res.append((N,1))
    return res def factorization(N):
    res=[]
    for i in range(2,int(N**(1/2))+2):
        if not N%i:
            r=0
            while not N%i:
                N//=i
                r+=1
            res.append((i,r))
    if N>1:
        res.append((N,1))
    return res factorization a,b=map(int,input().split()) map(int,input().split()) a b=map(int,input().split()) map(int,input().split()) b
from math import gcd

def factorization(N):
    res=[]
    for i in range(2,int(N**(1/2))+2):
        if not N%i:
            r=0
            while not N%i:
                N//=i
                r+=1
            res.append((i,r))
    if N>1:
        res.append((N,1))
    return res
a,b=map(int,input().split())
g=gcd(a,b)
print(1+len(factorization(g)))