def gcd(a,b):
    if b==0: return a
    return gcd(b,a%b)

def ela(g):
    s={1}
    i=2
    while i*i<=g:
        while g%i==0:
            g//=i
            s.add(i)
        i+=1
    if g!=1: s.add(g)
    return s

a,b=map(int,input().split())
G=gcd(max(a,b),min(a,b))
print(len(ela(G))) def gcd(a,b):
    if b==0: return a
    return gcd(b,a%b) gcd if b==0: return a
     b==0 b 0 return gcd(b,a%b) gcd(b,a%b) gcd b a%b a b a a b b def ela(g):
    s={1}
    i=2
    while i*i<=g:
        while g%i==0:
            g//=i
            s.add(i)
        i+=1
    if g!=1: s.add(g)
    return s ela s={1} s {1} i=2 i 2 while i*i<=g:
        while g%i==0:
            g//=i
            s.add(i)
        i+=1
     i*i<=g i*i i i g while g%i==0:
            g//=i
            s.add(i)
         g%i==0 g%i g i 0 g//=i g i s.add(i) s.add s add i i+=1 i 1 if g!=1: s.add(g)
     g!=1 g 1 return s s g g a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b G=gcd(max(a,b),min(a,b)) G gcd(max(a,b),min(a,b)) gcd max(a,b) max a b min(a,b) min a b print(len(ela(G))) print len(ela(G)) len ela(G) ela G G=gcd(max(a,b),min(a,b)) gcd(max(a,b),min(a,b)) G def ela(g):
    s={1}
    i=2
    while i*i<=g:
        while g%i==0:
            g//=i
            s.add(i)
        i+=1
    if g!=1: s.add(g)
    return s def ela(g):
    s={1}
    i=2
    while i*i<=g:
        while g%i==0:
            g//=i
            s.add(i)
        i+=1
    if g!=1: s.add(g)
    return s ela def gcd(a,b):
    if b==0: return a
    return gcd(b,a%b) def gcd(a,b):
    if b==0: return a
    return gcd(b,a%b) gcd b=map(int,input().split()) map(int,input().split()) b a,b=map(int,input().split()) map(int,input().split()) a
def gcd(a,b):
    if b==0: return a
    return gcd(b,a%b)

def ela(g):
    s={1}
    i=2
    while i*i<=g:
        while g%i==0:
            g//=i
            s.add(i)
        i+=1
    if g!=1: s.add(g)
    return s

a,b=map(int,input().split())
G=gcd(max(a,b),min(a,b))
print(len(ela(G)))