a,b=map(int,input().split())
def p(n):
    a = set([1])
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a
s=p(a)
l=list(s)
for x in l:
  if b%x!=0:
    s.remove(x)
print(len(s)) a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b def p(n):
    a = set([1])
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a p a = set([1]) a set([1]) set [1] 1 while n % 2 == 0:
        a.add(2)
        n //= 2
     n % 2 == 0 n % 2 n 2 0 a.add(2) a.add a add 2 n //= 2 n 2 f = 3 f 3 while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
     f * f <= n f * f f f n if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
     n % f == 0 n % f n f 0 a.add(f) a.add a add f n //= f n f f += 2 f 2 if n != 1:
        a.add(n)
     n != 1 n 1 a.add(n) a.add a add n return a a n n s=p(a) s p(a) p a l=list(s) l list(s) list s for x in l:
  if b%x!=0:
    s.remove(x) x l if b%x!=0:
    s.remove(x) b%x!=0 b%x b x 0 s.remove(x) s.remove s remove x print(len(s)) print len(s) len s s=p(a) p(a) s b=map(int,input().split()) map(int,input().split()) b l=list(s) list(s) l a,b=map(int,input().split()) map(int,input().split()) a def p(n):
    a = set([1])
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a def p(n):
    a = set([1])
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a p
a,b=map(int,input().split())
def p(n):
    a = set([1])
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a
s=p(a)
l=list(s)
for x in l:
  if b%x!=0:
    s.remove(x)
print(len(s))