import java.lang.Math.sqrt

fun main(args: Array<String>) {
    val array = IntArray(readLine()?.toInt() ?: 0) {
        readLine()?.toInt() ?: 0
    }
    val primeJudge = PrimeJudge(array.max() ?: 0)
    println(array.filter(primeJudge::isPrime).count())
}

class PrimeJudge(max: Int) {
    private val numArray = BooleanArray(max+1) { true }
    init {
        numArray[0] = false
        numArray[1] = false
        for (i in 2..sqrt(numArray.size.toDouble()).toInt()) {
            if (numArray[i]) {
                for (j in i * 2 until numArray.size step i) {
                    numArray[j] = false
                }
            }
        }
    }
    fun isPrime(num: Int) = numArray[num]
}
