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

def prime_factor(n):
    res = set([1])
    for i in range(2, n + 1):
        if i * i > n:
            break
            
        while n % i == 0:
            res.add(i)
            n //= i
            
    if n != 1:
        res.add(n)
        
    return res

print(len(prime_factor(A) & prime_factor(B))) A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B def prime_factor(n):
    res = set([1])
    for i in range(2, n + 1):
        if i * i > n:
            break
            
        while n % i == 0:
            res.add(i)
            n //= i
            
    if n != 1:
        res.add(n)
        
    return res prime_factor res = set([1]) res set([1]) set [1] 1 for i in range(2, n + 1):
        if i * i > n:
            break
            
        while n % i == 0:
            res.add(i)
            n //= i
            
     i range(2, n + 1) range 2 n + 1 n 1 if i * i > n:
            break
            
         i * i > n i * i i i n break while n % i == 0:
            res.add(i)
            n //= i
            
     n % i == 0 n % i n i 0 res.add(i) res.add res add i n //= i n i if n != 1:
        res.add(n)
        
     n != 1 n 1 res.add(n) res.add res add n return res res n n print(len(prime_factor(A) & prime_factor(B))) print len(prime_factor(A) & prime_factor(B)) len prime_factor(A) & prime_factor(B) prime_factor(A) prime_factor A prime_factor(B) prime_factor B B = map(int, input().split()) map(int, input().split()) B def prime_factor(n):
    res = set([1])
    for i in range(2, n + 1):
        if i * i > n:
            break
            
        while n % i == 0:
            res.add(i)
            n //= i
            
    if n != 1:
        res.add(n)
        
    return res def prime_factor(n):
    res = set([1])
    for i in range(2, n + 1):
        if i * i > n:
            break
            
        while n % i == 0:
            res.add(i)
            n //= i
            
    if n != 1:
        res.add(n)
        
    return res prime_factor A, B = map(int, input().split()) map(int, input().split()) A
A, B = map(int, input().split())

def prime_factor(n):
    res = set([1])
    for i in range(2, n + 1):
        if i * i > n:
            break
            
        while n % i == 0:
            res.add(i)
            n //= i
            
    if n != 1:
        res.add(n)
        
    return res

print(len(prime_factor(A) & prime_factor(B)))
