import java.math.BigInteger

/**
 * Created by m00nlight on 7/27/15.
 */
object Solution {
  def main(args: Array[String]) {
    val xs = io.Source.stdin.getLines.toList.map(_.toInt).drop(1)
    println(xs.filter {x => {
      val xx = new BigInt(BigInteger.valueOf(x))
      xx.isProbablePrime(29)
    }}.size)
  }
}