import math

A,B = map(int,input().split())
G = math.gcd(A,B)

N = G
#素因数分解
sep = []
for i in range(2,int(math.sqrt(N))+2,1):
    if N % i ==0:
        count = 0
        while N % i == 0:
            N = N//i
            count += 1
        sep.append([i,count])
if N != 1:
    sep.append([N,1])

print(len(sep)+1) import math math A,B = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B G = math.gcd(A,B) G math.gcd(A,B) math.gcd math gcd A B N = G N G sep = [] sep [] for i in range(2,int(math.sqrt(N))+2,1):
    if N % i ==0:
        count = 0
        while N % i == 0:
            N = N//i
            count += 1
        sep.append([i,count]) i range(2,int(math.sqrt(N))+2,1) range 2 int(math.sqrt(N))+2 int(math.sqrt(N)) int math.sqrt(N) math.sqrt math sqrt N 2 1 if N % i ==0:
        count = 0
        while N % i == 0:
            N = N//i
            count += 1
        sep.append([i,count]) N % i ==0 N % i N i 0 count = 0 count 0 while N % i == 0:
            N = N//i
            count += 1
         N % i == 0 N % i N i 0 N = N//i N N//i N i count += 1 count 1 sep.append([i,count]) sep.append sep append [i,count] i count if N != 1:
    sep.append([N,1]) N != 1 N 1 sep.append([N,1]) sep.append sep append [N,1] N 1 print(len(sep)+1) print len(sep)+1 len(sep) len sep 1 N = N//i N//i N sep = [] [] sep N = G G N A,B = map(int,input().split()) map(int,input().split()) A count = 0 0 count G = math.gcd(A,B) math.gcd(A,B) G count += 1 1 count B = map(int,input().split()) map(int,input().split()) B
import math

A,B = map(int,input().split())
G = math.gcd(A,B)

N = G
#素因数分解
sep = []
for i in range(2,int(math.sqrt(N))+2,1):
    if N % i ==0:
        count = 0
        while N % i == 0:
            N = N//i
            count += 1
        sep.append([i,count])
if N != 1:
    sep.append([N,1])

print(len(sep)+1)