include Math
require 'prime'

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

n.times {
  x = gets.to_i
  if (x <= 10000)
    c += 1 if (root_prime.include?(x))
    next
  end
  xs = sqrt(x).floor
  root_prime.each{ |rp|
    if (rp > xs)
      c += 1
      break
    end
    break if (x % rp == 0)
  }
}
puts c