import scala.io.StdIn.readInt
import scala.annotation.tailrec
object Main {
    def main(args: Array[String]): Unit = {
        val len = readInt()
        var parr = Array(2)
        var ret = 0
        var maxInput = 2
        for (i <- (1 to len)) {
            val n = readInt()
            if (n > maxInput) parr = primes(maxInput, n, parr)
            if (inArray(n, parr)) ret += 1
        }
        println(ret)
    }
    def inArray(n: Int, arr: Array[Int]): Boolean = {
        @tailrec
        def inArray1(n1: Int, first: Int, last: Int, arr1:Array[Int]): Boolean = ((first + last) / 2) match {
            case a: Int if n1 == arr(a) => true
            case a: Int if first == last => false
            case a: Int if n1 < arr(a) => inArray1(n1, first, a, arr1)
            case a: Int if n1 > arr(a) => inArray1(n1, a + 1, last, arr1)
        }
        inArray1(n, 0, arr.length - 1, arr)
    }
    
    def check(v: Int, primes: Array[Int]): Boolean = {
        primes.foreach(i => if (v % i == 0) return false)
        true
    }
    
    @tailrec
    def primes(from: Int, to: Int, arr: Array[Int]): Array[Int] = from match {
        case a: Int if a > to => arr
        case a: Int if !check(a, arr)=> primes(a + 1, to, arr)
        case a: Int => primes(a + 1, to, arr :+ a)
    }
}
