import math

a,b = map(int,input().split())
x = math.gcd(a,b)
s = [1]
for i in range(2,int(math.sqrt(x)+1)):
    if x%i == 0:
        while x%i == 0:
            x //= i
        s.append(i)
if x != 1:
    s.append(x)
l = len(s)
print(l) import math math a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b x = math.gcd(a,b) x math.gcd(a,b) math.gcd math gcd a b s = [1] s [1] 1 for i in range(2,int(math.sqrt(x)+1)):
    if x%i == 0:
        while x%i == 0:
            x //= i
        s.append(i) i range(2,int(math.sqrt(x)+1)) range 2 int(math.sqrt(x)+1) int math.sqrt(x)+1 math.sqrt(x) math.sqrt math sqrt x 1 if x%i == 0:
        while x%i == 0:
            x //= i
        s.append(i) x%i == 0 x%i x i 0 while x%i == 0:
            x //= i
         x%i == 0 x%i x i 0 x //= i x i s.append(i) s.append s append i if x != 1:
    s.append(x) x != 1 x 1 s.append(x) s.append s append x l = len(s) l len(s) len s print(l) print l s = [1] [1] s x = math.gcd(a,b) math.gcd(a,b) x x //= i i x l = len(s) len(s) l a,b = map(int,input().split()) map(int,input().split()) a b = map(int,input().split()) map(int,input().split()) b
import math

a,b = map(int,input().split())
x = math.gcd(a,b)
s = [1]
for i in range(2,int(math.sqrt(x)+1)):
    if x%i == 0:
        while x%i == 0:
            x //= i
        s.append(i)
if x != 1:
    s.append(x)
l = len(s)
print(l)