A,B = list(map(int,input().split()))
# A=10**10
# B=10**12

def gcd(a,b):
    x=min(a,b)
    y=max(a,b)
    
    while y%x != 0:
#         print(x,y)
        x_= y%x
        y = x
        x = x_
    return x

gcd = gcd(A,B)

def prime_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 a

P_F=[1]
P_F.extend(prime_factorize(gcd))
print(len(set(P_F))) A,B = list(map(int,input().split())) A list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split B def gcd(a,b):
    x=min(a,b)
    y=max(a,b)
    
    while y%x != 0:
#         print(x,y)
        x_= y%x
        y = x
        x = x_
    return x gcd x=min(a,b) x min(a,b) min a b y=max(a,b) y max(a,b) max a b while y%x != 0:
#         print(x,y)
        x_= y%x
        y = x
        x = x_
     y%x != 0 y%x y x 0 x_= y%x x_ y%x y x y = x y x x = x_ x x_ return x x a a b b gcd = gcd(A,B) gcd gcd(A,B) gcd A B def prime_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 a prime_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 a a n n P_F=[1] P_F [1] 1 P_F.extend(prime_factorize(gcd)) P_F.extend P_F extend prime_factorize(gcd) prime_factorize gcd print(len(set(P_F))) print len(set(P_F)) len set(P_F) set P_F P_F=[1] [1] P_F gcd = gcd(A,B) gcd(A,B) gcd def prime_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 a def prime_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 a prime_factorize A,B = list(map(int,input().split())) list(map(int,input().split())) A def gcd(a,b):
    x=min(a,b)
    y=max(a,b)
    
    while y%x != 0:
#         print(x,y)
        x_= y%x
        y = x
        x = x_
    return x def gcd(a,b):
    x=min(a,b)
    y=max(a,b)
    
    while y%x != 0:
#         print(x,y)
        x_= y%x
        y = x
        x = x_
    return x gcd B = list(map(int,input().split())) list(map(int,input().split())) B
A,B = list(map(int,input().split()))
# A=10**10
# B=10**12

def gcd(a,b):
    x=min(a,b)
    y=max(a,b)
    
    while y%x != 0:
#         print(x,y)
        x_= y%x
        y = x
        x = x_
    return x

gcd = gcd(A,B)

def prime_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 a

P_F=[1]
P_F.extend(prime_factorize(gcd))
print(len(set(P_F)))