
def eratosthenes(n)
  table = Array.new(n + 1,true)
  prime_list = []

  (2..n).each do |num|
      if table[num] == true
        prime_list << num
      k = num * num
      while k <= n
        table[k] = false
        k += num
      end
    end
  end
  return prime_list
end

def main()
  n = gets.to_i
  a = []
  n.times.each { |i|
    a.push(gets.to_i)
  }
  primes = eratosthenes(a.max)
  cnt = 0
  a.each { |e|
    if primes.include?(e) then
      cnt += 1
    end
  }
  puts cnt
end

main

