require 'prime'

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


n.times{
    a = gets.chomp.to_i
    if a != 2 && a.even?
        next
    else
        arr[i] = a
        i += 1
    end
}

Prime.each(100000){ |prime|
    p[j] = prime
    j += 1
}

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

puts count