# frozen_string_literal: true

limit = 10_000
limit_sqrt = 100
numbers = Array.new(limit + 1, true)
numbers[0], numbers[1] = false
primes = []
numbers.each_with_index do |b, i|
  next unless b

  primes << i
  next if i > limit_sqrt

  (2..(limit / i)).each do |j|
    numbers[i * j] = false
  end
end
n = gets.to_i
input_numbers = n.times.map { gets.to_i }
res = input_numbers.count do |x|
  primes.none? { |prime| (x % prime).zero? && x / prime > 1 }
end
puts res

