import java.util.Scanner

import scala.io.StdIn._
object Main extends App {

  def read(): (Int, Array[Int]) = {
    val sc: Scanner = new Scanner(System.in)
    val n = sc.nextInt()
    val arr = Array.fill(n)(sc.nextInt)
    sc.close()
    (n, arr)
  }

  def solve(): Int = {
    val (_, arr) = read()
    val sorted = arr.sorted
    val len = sorted.length
    val maxLen = Math.max(len, sorted(len-1)) + 1
    val cntArr = Array.fill(maxLen)(0)

    sorted.foreach { num =>
      if(cntArr(num) != 0) cntArr(num) = 2
      else (num until maxLen by num).foreach(cntArr(_) += 1)
    }
    sorted.foldLeft(0) { (cnt, num) =>
      if(cntArr(num) == 1) cnt+1 else cnt
    }
  }

  println(solve())

}
