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

def fact(n):
    k = 2
    l = [] 
    temp=n
    while pow(k, 2)<=n:
        if temp%k==0:
            l.append(k)
            while temp%k==0:
                temp//=k
        k+=1
    if temp!=1:
        l.append(temp)
    return l

if A==1 and B==1:
    print(1)
elif A==B:
    print(len(set(fact(A)))+1)
else:
    print(len(set(fact(A))&set(fact(B)))+1) A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B def fact(n):
    k = 2
    l = [] 
    temp=n
    while pow(k, 2)<=n:
        if temp%k==0:
            l.append(k)
            while temp%k==0:
                temp//=k
        k+=1
    if temp!=1:
        l.append(temp)
    return l fact k = 2 k 2 l = [] l [] temp=n temp n while pow(k, 2)<=n:
        if temp%k==0:
            l.append(k)
            while temp%k==0:
                temp//=k
        k+=1
     pow(k, 2)<=n pow(k, 2) pow k 2 n if temp%k==0:
            l.append(k)
            while temp%k==0:
                temp//=k
         temp%k==0 temp%k temp k 0 l.append(k) l.append l append k while temp%k==0:
                temp//=k
         temp%k==0 temp%k temp k 0 temp//=k temp k k+=1 k 1 if temp!=1:
        l.append(temp)
     temp!=1 temp 1 l.append(temp) l.append l append temp return l l n n if A==1 and B==1:
    print(1)
elif A==B:
    print(len(set(fact(A)))+1)
else:
    print(len(set(fact(A))&set(fact(B)))+1) A==1 and B==1 A==1 A 1 B==1 B 1 print(1) print 1 elif A==B:
    print(len(set(fact(A)))+1) A==B A B print(len(set(fact(A)))+1) print len(set(fact(A)))+1 len(set(fact(A))) len set(fact(A)) set fact(A) fact A 1 print(len(set(fact(A))&set(fact(B)))+1) print len(set(fact(A))&set(fact(B)))+1 len(set(fact(A))&set(fact(B))) len set(fact(A))&set(fact(B)) set(fact(A)) set fact(A) fact A set(fact(B)) set fact(B) fact B 1 def fact(n):
    k = 2
    l = [] 
    temp=n
    while pow(k, 2)<=n:
        if temp%k==0:
            l.append(k)
            while temp%k==0:
                temp//=k
        k+=1
    if temp!=1:
        l.append(temp)
    return l def fact(n):
    k = 2
    l = [] 
    temp=n
    while pow(k, 2)<=n:
        if temp%k==0:
            l.append(k)
            while temp%k==0:
                temp//=k
        k+=1
    if temp!=1:
        l.append(temp)
    return l fact B = map(int, input().split()) map(int, input().split()) B A, B = map(int, input().split()) map(int, input().split()) A
A, B = map(int, input().split())

def fact(n):
    k = 2
    l = [] 
    temp=n
    while pow(k, 2)<=n:
        if temp%k==0:
            l.append(k)
            while temp%k==0:
                temp//=k
        k+=1
    if temp!=1:
        l.append(temp)
    return l

if A==1 and B==1:
    print(1)
elif A==B:
    print(len(set(fact(A)))+1)
else:
    print(len(set(fact(A))&set(fact(B)))+1)