import scala.io.Source
import Math.sqrt

object Main{
  def main(args: Array[String]){
    val lines = for{
      in <- Source.stdin.getLines.toList.map(_.toInt)
    }yield in

    println(lines.tail.filter(prime(_)).length)
  }

  def prime(n: Int): Boolean = sieve(n).contains(n)

  def sieve(n: Int): List[Int] = reduceMultiple((2 to n).toList, 2, n)

  def reduceMultiple(list: List[Int], n: Int, max: Int): List[Int] ={
    if(n > sqrt(max)) list
    else reduceMultiple(list.filterNot(_ % n == 0), n+1, max)
  }
}