a,b=map(int,input().split())
def factorize(n):
    a=[]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f<=n:
        if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        a.append(n)
    return set(a)
print(len(factorize(a)&factorize(b))+1) a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b def factorize(n):
    a=[]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f<=n:
        if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        a.append(n)
    return set(a) factorize a=[] a [] while n%2==0:
        a.append(2)
        n//=2
     n%2==0 n%2 n 2 0 a.append(2) a.append a append 2 n//=2 n 2 f=3 f 3 while f*f<=n:
        if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
     f*f<=n f*f f f n if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
     n%f==0 n%f n f 0 a.append(f) a.append a append f n//=f n f f+=2 f 2 if n!=1:
        a.append(n)
     n!=1 n 1 a.append(n) a.append a append n return set(a) set(a) set a n n print(len(factorize(a)&factorize(b))+1) print len(factorize(a)&factorize(b))+1 len(factorize(a)&factorize(b)) len factorize(a)&factorize(b) factorize(a) factorize a factorize(b) factorize b 1 a,b=map(int,input().split()) map(int,input().split()) a def factorize(n):
    a=[]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f<=n:
        if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        a.append(n)
    return set(a) def factorize(n):
    a=[]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f<=n:
        if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        a.append(n)
    return set(a) factorize b=map(int,input().split()) map(int,input().split()) b
a,b=map(int,input().split())
def factorize(n):
    a=[]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f<=n:
        if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        a.append(n)
    return set(a)
print(len(factorize(a)&factorize(b))+1)