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

def factorization(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 a

s_a=set(factorization(a))
s_b=set(factorization(b))
ans_arr=s_a&s_b
print(len(ans_arr)+1) a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b def factorization(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 a factorization 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 a a n n s_a=set(factorization(a)) s_a set(factorization(a)) set factorization(a) factorization a s_b=set(factorization(b)) s_b set(factorization(b)) set factorization(b) factorization b ans_arr=s_a&s_b ans_arr s_a&s_b s_a s_b print(len(ans_arr)+1) print len(ans_arr)+1 len(ans_arr) len ans_arr 1 s_a=set(factorization(a)) set(factorization(a)) s_a s_b=set(factorization(b)) set(factorization(b)) s_b ans_arr=s_a&s_b s_a&s_b ans_arr b=map(int,input().split()) map(int,input().split()) b def factorization(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 a def factorization(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 a factorization a,b=map(int,input().split()) map(int,input().split()) a
a,b=map(int,input().split())

def factorization(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 a

s_a=set(factorization(a))
s_b=set(factorization(b))
ans_arr=s_a&s_b
print(len(ans_arr)+1)