object Main {
  def main(args: Array[String]): Unit = {
    val n = io.StdIn.readInt()
    val count =
      Iterator.continually(io.StdIn.readInt())
        .take(n)
        .count(isPrime)
    println(count)
  }

  def isPrime(n: Int): Boolean = {
    val rt = Math.sqrt(n).toInt

    @annotation.tailrec
    def isPrime(i: Int): Boolean = {
      if (i <= rt)
        if (n % i ==0) false
        else isPrime(i + 2)
      else
        true
    }

    if (n == 2)
      true
    else if (n < 1 || n % 2 == 0)
      false
    else
      isPrime(3)
  }
}