Problem:
Score : 400 points

Problem Statement

Given is a number sequence A of length N.

Find the number of integers i \left(1 \leq i \leq N\right) with the following property:

For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Constraints

All values in input are integers.

1 \leq N \leq 2 \times 10^5

1 \leq A_i \leq 10^6

Input

Input is given from Standard Input in the following format:

N
A_1 A_2 \cdots A_N

Output

Print the answer.

Sample Input 1

5
24 11 8 3 16

Sample Output 1

3

The integers with the property are 2, 3, and 4.

Sample Input 2

4
5 5 5 5

Sample Output 2

0

Note that there can be multiple equal numbers.

Sample Input 3

10
33 18 45 28 8 19 89 86 2 4

Sample Output 3

5

Solution in PHP (7.4.4) (judge verdict: Wrong Answer)

<?php
$N = (int)trim(fgets(STDIN));
//list($X,$N) = array_map('intval',explode(" ",trim(fgets(STDIN))));
//$S = trim(fgets(STDIN));
$A = array_map('intval',explode(" ",trim(fgets(STDIN))));
$pri=array();
$odd=array();
$even=array();
foreach($A as $v) {
  if (is_prime($v)) {
    $pri[]=$v;
    continue;
  }
  if ($v % 2 == 0) {
    $odd[]=$v;
  }
  else {
    $even[]=$v;
  }
}
$tot=0;
$pc = array_count_values($pri);
//1つだけある素数
foreach($pc as $v) {
  if ($v == 1) $tot++;
}
//最小の偶数と、奇数...じゃ間違ってそう。
//割り切れないかどうか確認がいりそうな希ガス
sort($odd);
sort($even);
$pc = array_count_values($odd);
foreach($pc as $v) {
  if ($v==1) {
    $tot++;
    break;
  }
}
$pc = array_count_values($even);
foreach($pc as $v) {
  if ($v==1) {
    $tot++;
    break;
  }
}
printf("%d\n",$tot);
function gcd($a,$b) {
  if ($b == 0) return $a;
  return gcd($b,$a%$b);
}
function lcm($a,$b) {
  $l = gcd($a,$b);
  return $a / $l * $b;
}

function prime_factors(int $n) {
    $i = 2;
    $factors = [];
    while ($i * $i <= $n) {
        if ($n % $i) $i += 1;
        else {
            $n /= $i;
            $factors[] = $i;
        }
    }
    if ($n > 1) $factors[] = $n;
    return $factors;
}
function is_prime(int $n) : bool {
    $r = true;
    if ($n < 2) $r = false;
    elseif ($n == 2 || $n == 3 || $n == 5) $r = true;
    elseif ($n & 1 == 0) $r = false;
    elseif ($n % 2 == 0 || $n % 3 == 0 || $n % 5 == 0) $r = false;
    else {
        $f = true;
        $v = 7;
        $m = intval($n ** 0.5) + 1;
        while ($v < $m) {
            if ($n % $v == 0) {
                $r = false;
                break;
            }
            $v += $f ? 4 : 2;
            $f = !$f;
        }
    }
    return $r;
}