import scala.io.StdIn._

object Main {
  var map: Map[Int, Boolean] = Map.empty[Int, Boolean]

  def main(args: Array[String]): Unit = {
    val n = readInt
    if (n == 0) return
    val list = readIntList(n)
    val count = list.count(isPrimeNumber)
    println(count)
  }

  def readIntList(n: Int): List[Int] = {
    var list: Array[Int] = Array.empty
    for (i <- 0 until n) {
      list :+= readInt
    }
    list.toList
  }

  def isPrimeNumber(value: Int): Boolean = {
    if (value < 2) false
    else if (value == 2) true
    else if (value % 2 == 0) false
    else {
      val sqrt = Math.sqrt(value).toInt
      for (i <- 3 to sqrt by 2) {
        if (value % i == 0) {
          return false
        }
      }

      true
    }
  }
}

