import scala.util.control.Breaks

object Main extends App{
    // Your code here!
    val b1 = new Breaks
    var hoge = new Hoge()
    var primeCnt = 0
    var isFirst = true
    var loopMax = 0
    var loopCnt = 0;
    b1.breakable {
        for(line <- io.Source.stdin.getLines()) {
            if(isFirst) {
                isFirst = false
                loopMax = line.toInt
            } else {
                if(hoge.isPrime(line.toInt)){
                    primeCnt = primeCnt+1
                }
                loopCnt = loopCnt+1
                if(loopMax <= loopCnt){
                    b1.break
                }
            }
        }
    }
    println(primeCnt)
}

class Hoge() {
    def isPrime(n: Int): Boolean = {
        if (n < 2 || (n > 2 && n % 2 == 0)){
            return false
        } else if (n == 2) {
            return true
        }
        @annotation.tailrec
        def loop(n: Int, m: Int): Boolean = {
            if (m * m > n) {
                return true
            } else if (n % m == 0) {
                return false
            } else {
                loop(n, m + 2)
            }
        }
        loop(n, 3)
    }
}

