input = gets.chomp.split(" ").map(&:to_i).sort
 
require 'prime'
 
if input[0].prime? || input[1].prime?
  if input[0]==input[1]
    puts 2
  else
    puts 1
  end
else
  i = 2
  count = 1
 
  while (i <= input[0]) do
    if i.prime? && (input[0]%i ==0) && (input[1]%i ==0)
      count += 1
      input[0] = input[0]/i
    end
    i += 1
  end

 
  puts count
 
end
