a = []
gets.chomp.to_i.times do
  a.push(gets.chomp.to_i)
end

n = 0
a.each do |item|
  if item == 2
    n += 1
  else
    bool = true
    i = 3
    bool = false if item % 2 == 0
    until i > Math.sqrt(item) || bool == false
      bool = false if item % i == 0
      i += 2
    end
    n += 1 if bool == true
  end
end

puts n