from fractions import gcd

A,B=map(int,input().split())
p=set([1])
g=gcd(A,B)
for d in range(2,g):
    while g%d==0:
        p.add(d)
        g//=d
    if (d*d>=g): break
if g>=2:
    p.add(g)
print(len(p)) from fractions import gcd A,B=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B p=set([1]) p set([1]) set [1] 1 g=gcd(A,B) g gcd(A,B) gcd A B for d in range(2,g):
    while g%d==0:
        p.add(d)
        g//=d
    if (d*d>=g): break d range(2,g) range 2 g while g%d==0:
        p.add(d)
        g//=d
     g%d==0 g%d g d 0 p.add(d) p.add p add d g//=d g d if (d*d>=g): b d*d>=g d*d d d g if g>=2:
    p.add(g) g>=2 g 2 p.add(g) p.add p add g print(len(p)) print len(p) len p g=gcd(A,B) gcd(A,B) g B=map(int,input().split()) map(int,input().split()) B p=set([1]) set([1]) p A,B=map(int,input().split()) map(int,input().split()) A g//=d d g
from fractions import gcd

A,B=map(int,input().split())
p=set([1])
g=gcd(A,B)
for d in range(2,g):
    while g%d==0:
        p.add(d)
        g//=d
    if (d*d>=g): break
if g>=2:
    p.add(g)
print(len(p))
