from math import gcd
a, b = map(int, input().split())
x = gcd(a,b)
cnt = 1
for i in range(2, int(x ** 0.5) + 1):
        if x == 1:
            break
        if x % i == 0:
            cnt += 1
            while x % i == 0:
                x //= i
else:
    if x != 1:
        cnt += 1
print(cnt) from math import gcd a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b x = gcd(a,b) x gcd(a,b) gcd a b cnt = 1 cnt 1 for i in range(2, int(x ** 0.5) + 1):
        if x == 1:
            break
        if x % i == 0:
            cnt += 1
            while x % i == 0:
                x //= i
else:
    if x != 1:
        cnt += 1 i range(2, int(x ** 0.5) + 1) range 2 int(x ** 0.5) + 1 int(x ** 0.5) int x ** 0.5 x 0.5 1 if x == 1:
            break
         x == 1 x 1 break if x % i == 0:
            cnt += 1
            while x % i == 0:
                x //= i x % i == 0 x % i x i 0 cnt += 1 cnt 1 while x % i == 0:
                x //= i x % i == 0 x % i x i 0 x //= i x i if x != 1:
        cnt += 1 x != 1 x 1 cnt += 1 cnt 1 print(cnt) print cnt x //= i i x cnt = 1 1 cnt a, b = map(int, input().split()) map(int, input().split()) a cnt += 1 1 cnt cnt += 1 1 cnt x = gcd(a,b) gcd(a,b) x b = map(int, input().split()) map(int, input().split()) b
from math import gcd
a, b = map(int, input().split())
x = gcd(a,b)
cnt = 1
for i in range(2, int(x ** 0.5) + 1):
        if x == 1:
            break
        if x % i == 0:
            cnt += 1
            while x % i == 0:
                x //= i
else:
    if x != 1:
        cnt += 1
print(cnt)