import scala.io.StdIn.readInt
import scala.collection.mutable.ListBuffer
import Math.sqrt
object Main {
    def main(args: Array[String]): Unit = {
        val len = readInt()
        var ret: Int = 0
        var primes: ListBuffer[Int] = ListBuffer(2)
        var max = 0
        for (i <- (1 to len)) {
            val n = readInt()
            val ret1 = isPrime(n, primes)
            if (ret1._1) {ret += 1}
        }
        println(ret)
    }
    
    // 引数のprimesを変更してしまう問題がある
    def isPrime(target: Int, primes: ListBuffer[Int]): (Boolean, ListBuffer[Int]) = {
        if (!isPrimeSub(target, primes)) {
            return (false, primes)
        } else {
            while (primes.last <= sqrt(target).toInt) {
                primes += nextPrime(primes)
                if (target % primes.last == 0) {
                    return (false, primes)
                }
            }
            return (true, primes)
        }
    }
    def isPrimeSub(target: Int, primes: ListBuffer[Int]): Boolean = primes match {
        case x +: xs if x >sqrt(target).toInt => true
        case x +: xs if target % x == 0 => false
        case x +: xs => isPrimeSub(target, xs)
        case _ if target == 1=> false
        case _ => true
    }
    def nextPrime(primes: ListBuffer[Int]): Int = {
        def go(n: Int, list: ListBuffer[Int]): Int = n match {
            case a if isPrimeSub(a, list) => a
            case a => go(a + 1, list)
        }
        if (primes.length == 0) 2 else go(primes.last + 1, primes)
    }
}
