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

def prime_factorize(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
print(len(prime_factorize(a) & prime_factorize(b))) a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b def prime_factorize(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 prime_factorize a = set({1}) a set({1}) set {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 print(len(prime_factorize(a) & prime_factorize(b))) print len(prime_factorize(a) & prime_factorize(b)) len prime_factorize(a) & prime_factorize(b) prime_factorize(a) prime_factorize a prime_factorize(b) prime_factorize b b = map(int, input().split()) map(int, input().split()) b a, b = map(int, input().split()) map(int, input().split()) a def prime_factorize(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 prime_factorize(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 prime_factorize
a, b = map(int, input().split())

def prime_factorize(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
print(len(prime_factorize(a) & prime_factorize(b)))