from math import gcd,sqrt,floor
a,b = map(int,input().split())
c = gcd(a,b)
x = []
for i in range(1,floor(sqrt(c))+1):
    if c % i == 0:
        x.append(i)
        x.append(c//i)
x.sort()
y = []
i = 1
while c > 1 and i < len(x):
    if c % x[i] == 0:
        y.append(x[i])
        c = c // x[i]
    else:
        i += 1
print(len(set(y))+1) from math import gcd,sqrt,floor a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b c = gcd(a,b) c gcd(a,b) gcd a b x = [] x [] for i in range(1,floor(sqrt(c))+1):
    if c % i == 0:
        x.append(i)
        x.append(c//i) i range(1,floor(sqrt(c))+1) range 1 floor(sqrt(c))+1 floor(sqrt(c)) floor sqrt(c) sqrt c 1 if c % i == 0:
        x.append(i)
        x.append(c//i) c % i == 0 c % i c i 0 x.append(i) x.append x append i x.append(c//i) x.append x append c//i c i x.sort() x.sort x sort y = [] y [] i = 1 i 1 while c > 1 and i < len(x):
    if c % x[i] == 0:
        y.append(x[i])
        c = c // x[i]
    else:
        i += 1 c > 1 and i < len(x) c > 1 c 1 i < len(x) i len(x) len x if c % x[i] == 0:
        y.append(x[i])
        c = c // x[i]
    else:
        i += 1 c % x[i] == 0 c % x[i] c x[i] x i 0 y.append(x[i]) y.append y append x[i] x i c = c // x[i] c c // x[i] c x[i] x i i += 1 i 1 print(len(set(y))+1) print len(set(y))+1 len(set(y)) len set(y) set y 1 c = c // x[i] c // x[i] c b = map(int,input().split()) map(int,input().split()) b y = [] [] y x = [] [] x i = 1 1 i i += 1 1 i c = gcd(a,b) gcd(a,b) c a,b = map(int,input().split()) map(int,input().split()) a
from math import gcd,sqrt,floor
a,b = map(int,input().split())
c = gcd(a,b)
x = []
for i in range(1,floor(sqrt(c))+1):
    if c % i == 0:
        x.append(i)
        x.append(c//i)
x.sort()
y = []
i = 1
while c > 1 and i < len(x):
    if c % x[i] == 0:
        y.append(x[i])
        c = c // x[i]
    else:
        i += 1
print(len(set(y))+1)