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

def factors_count(n):
    facs = dict()
    while n%2 == 0:
        facs.setdefault(2, 0)
        facs[2] += 1
        n //=2

    for f in range(3, int(n**0.5)+ 1, 2):
        while n%f == 0:
            facs.setdefault(f, 0)
            facs[f] += 1
            n //= f
    if n != 1:
        facs.setdefault(n, 0)
        facs[n] += 1
    return facs

afacs = factors_count(a)
bfacs = factors_count(b)

facs = set(afacs.keys()) & set(bfacs.keys())
print(len(facs)+1) a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b def factors_count(n):
    facs = dict()
    while n%2 == 0:
        facs.setdefault(2, 0)
        facs[2] += 1
        n //=2

    for f in range(3, int(n**0.5)+ 1, 2):
        while n%f == 0:
            facs.setdefault(f, 0)
            facs[f] += 1
            n //= f
    if n != 1:
        facs.setdefault(n, 0)
        facs[n] += 1
    return facs factors_count facs = dict() facs dict() dict while n%2 == 0:
        facs.setdefault(2, 0)
        facs[2] += 1
        n //=2

     n%2 == 0 n%2 n 2 0 facs.setdefault(2, 0) facs.setdefault facs setdefault 2 0 facs[2] += 1 facs[2] facs 2 1 n //=2 n 2 for f in range(3, int(n**0.5)+ 1, 2):
        while n%f == 0:
            facs.setdefault(f, 0)
            facs[f] += 1
            n //= f
     f range(3, int(n**0.5)+ 1, 2) range 3 int(n**0.5)+ 1 int(n**0.5) int n**0.5 n 0.5 1 2 while n%f == 0:
            facs.setdefault(f, 0)
            facs[f] += 1
            n //= f
     n%f == 0 n%f n f 0 facs.setdefault(f, 0) facs.setdefault facs setdefault f 0 facs[f] += 1 facs[f] facs f 1 n //= f n f if n != 1:
        facs.setdefault(n, 0)
        facs[n] += 1
     n != 1 n 1 facs.setdefault(n, 0) facs.setdefault facs setdefault n 0 facs[n] += 1 facs[n] facs n 1 return facs facs n n afacs = factors_count(a) afacs factors_count(a) factors_count a bfacs = factors_count(b) bfacs factors_count(b) factors_count b facs = set(afacs.keys()) & set(bfacs.keys()) facs set(afacs.keys()) & set(bfacs.keys()) set(afacs.keys()) set afacs.keys() afacs.keys afacs keys set(bfacs.keys()) set bfacs.keys() bfacs.keys bfacs keys print(len(facs)+1) print len(facs)+1 len(facs) len facs 1 b = map(int, input().split()) map(int, input().split()) b afacs = factors_count(a) factors_count(a) afacs def factors_count(n):
    facs = dict()
    while n%2 == 0:
        facs.setdefault(2, 0)
        facs[2] += 1
        n //=2

    for f in range(3, int(n**0.5)+ 1, 2):
        while n%f == 0:
            facs.setdefault(f, 0)
            facs[f] += 1
            n //= f
    if n != 1:
        facs.setdefault(n, 0)
        facs[n] += 1
    return facs def factors_count(n):
    facs = dict()
    while n%2 == 0:
        facs.setdefault(2, 0)
        facs[2] += 1
        n //=2

    for f in range(3, int(n**0.5)+ 1, 2):
        while n%f == 0:
            facs.setdefault(f, 0)
            facs[f] += 1
            n //= f
    if n != 1:
        facs.setdefault(n, 0)
        facs[n] += 1
    return facs factors_count bfacs = factors_count(b) factors_count(b) bfacs facs = set(afacs.keys()) & set(bfacs.keys()) set(afacs.keys()) & set(bfacs.keys()) facs a, b = map(int, input().split()) map(int, input().split()) a
a, b = map(int, input().split())

def factors_count(n):
    facs = dict()
    while n%2 == 0:
        facs.setdefault(2, 0)
        facs[2] += 1
        n //=2

    for f in range(3, int(n**0.5)+ 1, 2):
        while n%f == 0:
            facs.setdefault(f, 0)
            facs[f] += 1
            n //= f
    if n != 1:
        facs.setdefault(n, 0)
        facs[n] += 1
    return facs

afacs = factors_count(a)
bfacs = factors_count(b)

facs = set(afacs.keys()) & set(bfacs.keys())
print(len(facs)+1)
