A, B = map(int, input().split())

def prime_factorize(n):
    res = set()
    i = 2
    while i * i <= n:
        if n % i == 0:
            res.add(i)
            while n % i == 0:
                n //= i
        i += 1
    if n != 1:
        res.add(n)
    return res

ans = prime_factorize(A) & prime_factorize(B)
print(len(ans) + 1) A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B def prime_factorize(n):
    res = set()
    i = 2
    while i * i <= n:
        if n % i == 0:
            res.add(i)
            while n % i == 0:
                n //= i
        i += 1
    if n != 1:
        res.add(n)
    return res prime_factorize res = set() res set() set i = 2 i 2 while i * i <= n:
        if n % i == 0:
            res.add(i)
            while n % i == 0:
                n //= i
        i += 1
     i * i <= n i * i i i n if n % i == 0:
            res.add(i)
            while n % i == 0:
                n //= i
         n % i == 0 n % i n i 0 res.add(i) res.add res add i while n % i == 0:
                n //= i
         n % i == 0 n % i n i 0 n //= i n i i += 1 i 1 if n != 1:
        res.add(n)
     n != 1 n 1 res.add(n) res.add res add n return res res n n ans = prime_factorize(A) & prime_factorize(B) ans prime_factorize(A) & prime_factorize(B) prime_factorize(A) prime_factorize A prime_factorize(B) prime_factorize B print(len(ans) + 1) print len(ans) + 1 len(ans) len ans 1 B = map(int, input().split()) map(int, input().split()) B ans = prime_factorize(A) & prime_factorize(B) prime_factorize(A) & prime_factorize(B) ans def prime_factorize(n):
    res = set()
    i = 2
    while i * i <= n:
        if n % i == 0:
            res.add(i)
            while n % i == 0:
                n //= i
        i += 1
    if n != 1:
        res.add(n)
    return res def prime_factorize(n):
    res = set()
    i = 2
    while i * i <= n:
        if n % i == 0:
            res.add(i)
            while n % i == 0:
                n //= i
        i += 1
    if n != 1:
        res.add(n)
    return res prime_factorize A, B = map(int, input().split()) map(int, input().split()) A
A, B = map(int, input().split())

def prime_factorize(n):
    res = set()
    i = 2
    while i * i <= n:
        if n % i == 0:
            res.add(i)
            while n % i == 0:
                n //= i
        i += 1
    if n != 1:
        res.add(n)
    return res

ans = prime_factorize(A) & prime_factorize(B)
print(len(ans) + 1)