a, b = map(int,input().split())
#素因数分解
def prime(n):
    i = 2
    table = set()
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.add(i)
        i += 1
    if n > 1:
        table.add(n)
    return table

print(len(prime(a).intersection(prime(b))) + 1) a, b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b def prime(n):
    i = 2
    table = set()
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.add(i)
        i += 1
    if n > 1:
        table.add(n)
    return table prime i = 2 i 2 table = set() table set() set while i * i <= n:
        while n % i == 0:
            n /= i
            table.add(i)
        i += 1
     i * i <= n i * i i i n while n % i == 0:
            n /= i
            table.add(i)
         n % i == 0 n % i n i 0 n /= i n i table.add(i) table.add table add i i += 1 i 1 if n > 1:
        table.add(n)
     n > 1 n 1 table.add(n) table.add table add n return table table n n print(len(prime(a).intersection(prime(b))) + 1) print len(prime(a).intersection(prime(b))) + 1 len(prime(a).intersection(prime(b))) len prime(a).intersection(prime(b)) (a).intersection (a) prime a intersection prime(b) prime b 1 a, b = map(int,input().split()) map(int,input().split()) a def prime(n):
    i = 2
    table = set()
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.add(i)
        i += 1
    if n > 1:
        table.add(n)
    return table def prime(n):
    i = 2
    table = set()
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.add(i)
        i += 1
    if n > 1:
        table.add(n)
    return table prime b = map(int,input().split()) map(int,input().split()) b
a, b = map(int,input().split())
#素因数分解
def prime(n):
    i = 2
    table = set()
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.add(i)
        i += 1
    if n > 1:
        table.add(n)
    return table

print(len(prime(a).intersection(prime(b))) + 1)