require 'prime'

n = gets.chomp.to_i
i, j, count = 0, 0, 0
arr = []
p = []

n.times{
  a = gets.chomp.to_i

  if a != 2 && a.even?
    next
  else
    arr[i] = a
    i += 1
  end
}

Pirme.each(10000){ |prime|
  p[j] = prime
  j += 1
}

arr.each{ |k|
  p.include?(k) && count += 1
}

puts count