import math

A, B = [int(_) for _ in input().split()]
N = math.gcd(A, B)

ans = 1
for i in range(2, int(math.sqrt(N)+1) + 1):
    if N % i == 0:
        ans += 1
        while N % i == 0:
            N //= i
if N > 1:
    ans += 1
print(ans) import math math int(_) for _ in input().split() for _ in input().split() _ input().split() ().split () input split for _ in input().split() int(_) int _ A, B = [int(_) for _ in input().split()] A [int(_) for _ in input().split()] B N = math.gcd(A, B) N math.gcd(A, B) math.gcd math gcd A B ans = 1 ans 1 for i in range(2, int(math.sqrt(N)+1) + 1):
    if N % i == 0:
        ans += 1
        while N % i == 0:
            N //= i i range(2, int(math.sqrt(N)+1) + 1) range 2 int(math.sqrt(N)+1) + 1 int(math.sqrt(N)+1) int math.sqrt(N)+1 math.sqrt(N) math.sqrt math sqrt N 1 1 if N % i == 0:
        ans += 1
        while N % i == 0:
            N //= i N % i == 0 N % i N i 0 ans += 1 ans 1 while N % i == 0:
            N //= i N % i == 0 N % i N i 0 N //= i N i if N > 1:
    ans += 1 N > 1 N 1 ans += 1 ans 1 print(ans) print ans N = math.gcd(A, B) math.gcd(A, B) N B = [int(_) for _ in input().split()] [int(_) for _ in input().split()] B A, B = [int(_) for _ in input().split()] [int(_) for _ in input().split()] A ans = 1 1 ans ans += 1 1 ans ans += 1 1 ans N //= i i N
import math

A, B = [int(_) for _ in input().split()]
N = math.gcd(A, B)

ans = 1
for i in range(2, int(math.sqrt(N)+1) + 1):
    if N % i == 0:
        ans += 1
        while N % i == 0:
            N //= i
if N > 1:
    ans += 1
print(ans)
