include Math
require 'prime'

n = gets.to_i
root_prime = Prime.each(10000).to_a
c = 0

n.times {
  catch(:next) do
    x = gets.to_i
    if (x <= 10000)
      c += 1 if (x == root_prime.bsearch{|i| x <= i})
      throw :next
    end
    xs = sqrt(x).floor
    root_prime.each{ |rp|
      break if (rp > xs)
      throw :next if (x % rp == 0)
    }
    c += 1
  end
}
puts c