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 Rust (1.42.0) (judge verdict: Wrong Answer)

use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

#[allow(dead_code)]
struct Scanner<'a> {
    cin: StdinLock<'a>,
}
#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn input<T: FromStr>(&mut self) -> T {
        self.read().unwrap()
    }

    fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.input()).collect()
    }

    fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }
}
fn enumerate_divisors(n: usize) -> Vec<usize> {
    let mut ret = Vec::new();
    let mut i = 1;
    while i * i <= n {
        if n % i == 0 {
            ret.push(i);
            if i != 1 && i * i != n {
                ret.push(n / i);
            }
        }
        i += 1;
    }
    ret
}
use std::collections::BTreeSet;
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let n: usize = sc.input();
    let mut arr: Vec<usize> = sc.vec(n);

    arr.sort();
    let mut sames = BTreeSet::new();
    let mut xs = vec![];
    let mut prev = 0usize;
    let mut same = false;
    for (i, &a) in arr.iter().enumerate() {
        if same {
            sames.insert(prev);
        }

        if a != prev {
            xs.push(a);
            prev = a;
            same = false;
        } else {
            same = true;
        }
    }
    let mut cnt: usize = 0;
    let mut set = BTreeSet::new();
    for a in xs {
        let divs = enumerate_divisors(a);
        let mut ok = true;
        for d in divs {
            if set.contains(&d) {
                ok = false;
            }
        }

        set.insert(a);
        if ok {
            cnt += 1;
        }
    }

    for s in sames {
        if set.contains(&s) {
            cnt -= 1;
        }
    }
    println!("{}", cnt);
}