local x,y = io.read("*l"):match("(%d+).(%d+)")
local numX,numY = tonumber(x),tonumber(y)
local result = 1

local function FindFactors(numZ)
  local arr = {}
  for i = 2, numZ do
    local check = false
    while numZ % i == 0 do
      numZ = numZ // i
      check = true
    end
    if check then
      table.insert(arr,1,i)
    end
  end
  return arr
end

local arrX = FindFactors(numX)
local arrY = FindFactors(numY)

for i=1,#arrX do
  for j=1,#arrY do
    if arrX[i] == arrY[j] then
      result = result + 1
    end
  end
end
print(result)