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

def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
def lcm(a,b):
    return int(a*b/gcd(a,b))

g=gcd(a,b)
def prime_factorization(n):
    #nを素因数分解して、昇順のリストを返す
    m=n
    ans = []
    p = 2

    while p<m**0.5:
        if n%p == 0:
            ans.append(p)
            while n%p==0:
                n /= p
        else:
            p += 1
            
    if n!=1:
        ans.append(int(n))
    
    return ans

l=prime_factorization(g)
print(len(l)+1) a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b) gcd if b==0:
        return a
    else:
        return gcd(b,a%b) b==0 b 0 return a a return gcd(b,a%b) gcd(b,a%b) gcd b a%b a b a a b b def lcm(a,b):
    return int(a*b/gcd(a,b)) lcm return int(a*b/gcd(a,b)) int(a*b/gcd(a,b)) int a*b/gcd(a,b) a*b a b gcd(a,b) gcd a b a a b b g=gcd(a,b) g gcd(a,b) gcd a b def prime_factorization(n):
    #nを素因数分解して、昇順のリストを返す
    m=n
    ans = []
    p = 2

    while p<m**0.5:
        if n%p == 0:
            ans.append(p)
            while n%p==0:
                n /= p
        else:
            p += 1
            
    if n!=1:
        ans.append(int(n))
    
    return ans prime_factorization m=n m n ans = [] ans [] p = 2 p 2 while p<m**0.5:
        if n%p == 0:
            ans.append(p)
            while n%p==0:
                n /= p
        else:
            p += 1
            
     p<m**0.5 p m**0.5 m 0.5 if n%p == 0:
            ans.append(p)
            while n%p==0:
                n /= p
        else:
            p += 1
            
     n%p == 0 n%p n p 0 ans.append(p) ans.append ans append p while n%p==0:
                n /= p
         n%p==0 n%p n p 0 n /= p n p p += 1 p 1 if n!=1:
        ans.append(int(n))
    
     n!=1 n 1 ans.append(int(n)) ans.append ans append int(n) int n return ans ans n n l=prime_factorization(g) l prime_factorization(g) prime_factorization g print(len(l)+1) print len(l)+1 len(l) len l 1 def lcm(a,b):
    return int(a*b/gcd(a,b)) def lcm(a,b):
    return int(a*b/gcd(a,b)) lcm l=prime_factorization(g) prime_factorization(g) l a,b=map(int,input().split()) map(int,input().split()) a g=gcd(a,b) gcd(a,b) g def prime_factorization(n):
    #nを素因数分解して、昇順のリストを返す
    m=n
    ans = []
    p = 2

    while p<m**0.5:
        if n%p == 0:
            ans.append(p)
            while n%p==0:
                n /= p
        else:
            p += 1
            
    if n!=1:
        ans.append(int(n))
    
    return ans def prime_factorization(n):
    #nを素因数分解して、昇順のリストを返す
    m=n
    ans = []
    p = 2

    while p<m**0.5:
        if n%p == 0:
            ans.append(p)
            while n%p==0:
                n /= p
        else:
            p += 1
            
    if n!=1:
        ans.append(int(n))
    
    return ans prime_factorization def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b) def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b) gcd b=map(int,input().split()) map(int,input().split()) b
a,b=map(int,input().split())

def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
def lcm(a,b):
    return int(a*b/gcd(a,b))

g=gcd(a,b)
def prime_factorization(n):
    #nを素因数分解して、昇順のリストを返す
    m=n
    ans = []
    p = 2

    while p<m**0.5:
        if n%p == 0:
            ans.append(p)
            while n%p==0:
                n /= p
        else:
            p += 1
            
    if n!=1:
        ans.append(int(n))
    
    return ans

l=prime_factorization(g)
print(len(l)+1)
