jiahuimbzuai/CoQuIR huggingface dataset:
//  [python]
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase
from typing import List
from collections import Counter


def get_no_dupes(arr: List[int]) -> List[int]:
    cntr = Counter(arr)
    ret = []
    for elem in cntr:
        if cntr[elem] == 1:
            ret.append(elem)
    return ret


def main() -> None:
    input()

    arr = list(map(int, input().split()))

    busted = [False] * (10 ** 6 + 10)

    seen = set()
    max_limit = 10 ** 6
    for num in arr:
        if num in seen:
            continue
        for i in range(2 * num, max_limit, num):
            busted[i] = True
        seen.add(num)

    arr = get_no_dupes(arr)
    cnt = 0
    for num in arr:
        if not busted[num]:
            cnt += 1

    print(cnt)


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self, **kwargs):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()
//  [python]
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase
from typing import List
from collections import Counter


class Solution:
    def numSubarrayProductLessThanK(self, nums: List[int], k: int) -> int:
        left = 0
        ans, prod = 0, 1
        lenght = 0
        for num in nums:
            if prod * num >= k:
                prod *= num
                lenght += 1
                while prod >= k:
                    prod //= nums[left]
                    left += 1
                    lenght -= 1
                ans += lenght
            else:
                prod *= num
                lenght += 1
                ans += lenght
            # print(ans)

        return ans


def get_no_dupes() -> List[int]:
    arr = list(map(int, input().split()))
    cntr = Counter(arr)
    ret = []
    for elem in cntr:
        if cntr[elem] == 1:
            ret.append(elem)
    return ret


def main() -> None:
    input()

    arr = get_no_dupes()

    busted = [False] * (10 ** 6 + 10)

    max_limit = 10 ** 6
    for num in arr:
        for i in range(2 * num, max_limit, num):
            busted[i] = True

    cnt = 0
    for num in arr:
        if not busted[num]:
            cnt += 1

    print(cnt)


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self, **kwargs):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()
//  [python]
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
#from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#import sympy
#from scipy.sparse.csgraph import breadth_first_order, depth_first_order, shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
import sys

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N = ni()
A = na()
A.sort()
li = [0] * (10 ** 6 + 1)
ans = 0
for i in range(N):
    now = A[i]
    if li[now] == 0:
        ans += 1
    for j in range(now, 10 ** 6 + 1, now):
        li[j] = 1
print(ans)
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main {
	static InputStream is = System.in;
	static String INPUT = "";

	public static void main(String[] args) throws Exception
	{
		int n = ni();
		int M = 1000001;
		int W = (M>>>6)+1;
		long[] f1 = new long[W];
		long[] f2 = new long[W];
		long[] ex = new long[W];
		for(int i = 0;i < n;i++){
			int v = ni();
			if(f1[v>>>6]<<~v>=0){
				f1[v>>>6] |= 1L<<v;
			}else{
				f2[v>>>6] |= 1L<<v;
			}
		}
		if(f1[0]<<~1<0){
			System.out.println((f2[0]>>>1&1)^1);
			return;
		}
		for(int i = 1;i*2 <= M;i++){
			if((f1[i>>>6]&~ex[i>>>6])<<~i<0){
				if(i <= 10){
					long t = 0;
					for(int k = 0;k < 64;k += i){
						t |= 1L<<k;
					}
					long old = ex[i>>>6]>>>i&1;
					int u = (i-64%i)%i;
					for(int k = 0, l = 0;k < W;k++, l+=u){
						if(l >= i)l -= i;
						ex[k] |= t<<l;
					}
					if(old == 0){
						ex[i>>>6] ^= 1L<<i;
					}
				}else{
					for(int j = i*2;j < M;j+=i){
						ex[j>>>6] |= 1L<<j;
					}
				}
			}
		}
		int ans = 0;
		for(int i = 0;i < W;i++){
			ans += Long.bitCount((f1[i]^f2[i])&~ex[i]);
		}
		System.out.println(ans);
	}
	
	private static byte[] inbuf = new byte[1024];
	static int lenbuf = 0, ptrbuf = 0;
	
	private static int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}
	
	private static boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
//	private static boolean isSpaceChar(int c) { return !(c >= 32 && c <= 126); }
	private static int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
	
	private static double nd() { return Double.parseDouble(ns()); }
	private static char nc() { return (char)skip(); }
	
	private static String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	private static char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}
	
	private static char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}
	
	private static int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}
	
	private static int ni()
	{
		int num = 0, b;
//		boolean minus = false;
//		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
//		if(b == '-'){
//			minus = true;
//			b = readByte();
//		}
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9')));
		
		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return num;
//				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private static void tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); }
}
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main {
	static InputStream is = System.in;
	static String INPUT = "";

	public static void main(String[] args) throws Exception
	{
		int n = ni();
		int M = 1000001;
		int W = (M>>>6)+1;
		long[] f1 = new long[W];
		long[] f2 = new long[W];
		long[] ex = new long[W];
		for(int i = 0;i < n;i++){
			int v = ni();
			if(f1[v>>>6]<<~v>=0){
				f1[v>>>6] |= 1L<<v;
			}else{
				f2[v>>>6] |= 1L<<v;
			}
		}
		if(f1[0]<<~1<0){
			System.out.println((f2[0]>>>1&1)^1);
			return;
		}
		for(int i = 1;i*2 <= M;i++){
			if((f1[i>>>6]&~ex[i>>>6])<<~i<0){
				for(int j = i*2;j < M;j+=i){
					ex[j>>>6] |= 1L<<j;
				}
			}
		}
		int ans = 0;
		for(int i = 0;i < W;i++){
			ans += Long.bitCount((f1[i]^f2[i])&~ex[i]);
		}
		System.out.println(ans);
	}
	
	private static byte[] inbuf = new byte[1024];
	static int lenbuf = 0, ptrbuf = 0;
	
	private static int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}
	
	private static boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
//	private static boolean isSpaceChar(int c) { return !(c >= 32 && c <= 126); }
	private static int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
	
	private static double nd() { return Double.parseDouble(ns()); }
	private static char nc() { return (char)skip(); }
	
	private static String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	private static char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}
	
	private static char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}
	
	private static int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}
	
	private static int ni()
	{
		int num = 0, b;
//		boolean minus = false;
//		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
//		if(b == '-'){
//			minus = true;
//			b = readByte();
//		}
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9')));
		
		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return num;
//				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private static void tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); }
}
//  [java]
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] minfactor = new int[101];
        boolean[] ng = new boolean[101];
        for (int i = 0; i < n; i++) {
            int num = sc.nextInt();
            if (minfactor[num] == 0) {
                minfactor[num] = num;
            } else {
                ng[num] = true;
            }
        }
        
        int ans = 0;
        for (int i = 1; i < 101; i++) {
            if (minfactor[i] == i) {
                if (!ng[i]) ans ++;
                
                for (int j = i; j < 101; j += i) {
                    minfactor[j] = i;
                }
            }
        }
        System.out.println(ans);
    }
}
//  [java]
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] minfactor = new int[1000001];
        boolean[] ng = new boolean[1000001];
        for (int i = 0; i < n; i++) {
            int num = sc.nextInt();
            if (minfactor[num] == 0) {
                minfactor[num] = num;
            } else {
                ng[num] = true;
            }
        }
        
        int ans = 0;
        for (int i = 1; i < 1000001; i++) {
            if (!ng[i] && minfactor[i] == i) {
                ans++;
                
                for (int j = i; j < 1000001; j += i) {
                    minfactor[j] = i;
                }
            }
        }
        System.out.println(ans);
    }
}
//  [cpp]
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += 72 - dig >> 3;
	return tmp;
}

char A[1000001];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	int N = getint();

	rep(i, N) A[getint()]++;

	if (A[1]) {
		if (A[1] == 1) co(1);
		else co(0);
		return 0;
	}
	if (A[2]) {
		int kotae = (A[2] == 1);
		for (int i = 3; i <= 500000; i += 2) {
			if (A[i]) {
				kotae += (A[i] == 1);
				for (int j = i + i; j <= 1000000; j += i) {
					A[j] = 0;
				}
			}
		}
		for (int i = 500001; i <= 1000000; i += 2) kotae += (A[i] == 1);
		co(kotae);
		return 0;
	}

	int kotae = 0;
	for (int i = 2; i <= 500000; i++) {
		if (A[i]) {
			kotae += (A[i] == 1);
			for (int j = i + i; j <= 1000000; j += i) {
				A[j] = 0;
			}
		}
	}
	for (int i = 500001; i <= 1000000; i++) kotae += (A[i] == 1);
	co(kotae);

	Would you please return 0;
}
//  [cpp]
#include <iostream>
#include<algorithm>

using namespace std;

const int N = 2*1e5+5;
const int MAX = 1e6+5;
int n;
bool danhDau[MAX];
int arr[N];

bool mark[MAX];

void Danhdau(bool danhDau[], int num){
    mark[num] = true;
    for(int i=num;i<MAX;i+=num){
        danhDau[i]=true;
    }
}

int main()
{
    int i, count=1;
    cin>>n;
    for(i=1;i<=n;i++)
        cin>>arr[i];
    sort(arr,arr+n);
    if(arr[1]==arr[2]) count=0;
    Danhdau(danhDau,arr[1]);
    for(i=2;i<=n;i++){
        if(danhDau[arr[i]]==false) count++;
        if (mark[arr[i]] == false) Danhdau(danhDau,arr[i]);
    }
    cout<<count;
    return 0;
}
//  [cpp]
#include <iostream>
#include<algorithm>

using namespace std;

const int N = 2*1e5+5;
const int MAX = 1e6+5;
int n;
bool danhDau[MAX];
int arr[N];

void Danhdau(bool danhDau[], int num){
    for(int i=num;i<MAX;i+=num){
        danhDau[i]=true;
    }
}

int main()
{
    int i, count=1;
    cin>>n;
    for(i=1;i<=n;i++)
        cin>>arr[i];
    sort(arr,arr+n);
    if(arr[1]==arr[2]) count=0;
    Danhdau(danhDau,arr[1]);
    for(i=2;i<=n;i++){
        if(danhDau[arr[i]]==false) count++;
        Danhdau(danhDau,arr[i]);
    }
    cout<<count;
    return 0;
}
//  [cpp]
#include <iostream>
#include<algorithm>

using namespace std;

const int N = 2*1e5+5;
const int MAX = 1e6+5;
int n;
bool danhDau[MAX];
int arr[N];

bool Danhdau(bool danhDau[MAX], int num){
    for(int i=num;i<MAX;i+=num){
        danhDau[i]=true;
    }
}

int main()
{
    int i, count=1;
    cin>>n;
    for(i=1;i<=n;i++)
        cin>>arr[i];
    sort(arr,arr+n);
    if(arr[1]==arr[2]) count=0;
    Danhdau(danhDau,arr[1]);
    for(i=2;i<=n;i++){
        if(danhDau[arr[i]]==false) count++;
        Danhdau(danhDau,arr[i]);
    }
    cout<<count;
}
//  [c]
char buf[2<<20];
sz;
cnt[1<<20];
main()
{
	read(0,buf,2<<20);
	int N=0;
	for(;;)
	{
		char k=buf[sz++];
		if(k<'0')break;
		N=N*10+k-'0';
	}
	for(int i=0;i<N;i++)
	{
		int A=0;
		for(;;)
		{
			char k=buf[sz++];
			if(k<'0')break;
			A=A*10+k-'0';
		}
		cnt[A]++;
	}
	int ans=0;
	for(int i=1;i<=1000000;i++)
	{
		if(cnt[i])
		{
			ans+=cnt[i]<2;
			for(int j=i+i;j<=1000000;j+=i)cnt[j]=0;
		}
	}
	printf("%d",ans);
}
//  [c]
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
char buf[2<<20],out[6];
sz;
cnt[1<<20];
main()
{
	read(0,buf,2<<20);
	int N=0;
	for(;;)
	{
		char k=buf[sz++];
		if(k<'0')break;
		N=N*10+k-'0';
	}
	for(int i=0;i<N;i++)
	{
		int A=0;
		for(;;)
		{
			char k=buf[sz++];
			if(k<'0')break;
			A=A*10+k-'0';
		}
		cnt[A]++;
	}
	int ans=0;
	for(int i=1;i<=1000000;i++)
	{
		if(cnt[i])
		{
			ans+=cnt[i]<2;
			for(int j=i+i;j<=1000000;j+=i)cnt[j]=0;
		}
	}
	int osz=6;
	do{
		out[--osz]=ans%10+'0';
	}while(ans/=10);
	write(1,out+osz,6-osz);
}
//  [c]
char buf[2<<20],out[6];
sz;
cnt[1<<20];
main()
{
	read(0,buf,2<<20);
	int N=0;
	for(;;)
	{
		char k=buf[sz++];
		if(k<'0')break;
		N=N*10+k-'0';
	}
	for(int i=0;i<N;i++)
	{
		int A=0;
		for(;;)
		{
			char k=buf[sz++];
			if(k<'0')break;
			A=A*10+k-'0';
		}
		cnt[A]++;
	}
	int ans=0;
	for(int i=1;i<=1000000;i++)
	{
		if(cnt[i])
		{
			ans+=cnt[i]<2;
			for(int j=i+i;j<=1000000;j+=i)cnt[j]=0;
		}
	}
	int osz=6;
	do{
		out[--osz]=ans%10+'0';
	}while(ans/=10);
	write(1,out+osz,6-osz);
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

int main()
{
    long n,i,j,count=0;
    int flag;
    scanf("%ld",&n);
    long num[n];
    for(i=0;i<n;i++)
    {
        scanf("%ld",&num[i]);
    }
    for(i=0;i<n;i++)
    {
        flag=1;
        for(j=0;j<n;j++)
        {
            if(i==j)continue;
            if(num[i]%num[j]==0)
                {
                    flag*=0;
                    break;
                }
        }
        if(flag==1)count++;
    }
    printf("%ld",count);
    return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

int main()
{
    long n,i,j,count=0;
    int flag;
    scanf("%ld",&n);
    long num[n];
    for(i=0;i<n;i++)
    {
        scanf("%ld",&num[i]);
    }
    for(i=0;i<n;i++)
    {
        flag=1;
        for(j=0;j<n;j++)
        {
            if(i==j)continue;
            if(num[i]%num[j]==0)
                flag*=0;
        }
        if(flag==1)count++;
    }
    printf("%ld",count);
    return 0;
}
//  [c]
#include <stdio.h>

int main(void){
  long int n,a[1000005],count[1000005]={0};
  scanf("%ld",&n);
  for(int i=1;i<=n;i++){
    scanf("%ld",&a[i]);
    count[a[i]]++;
    if(count[a[i]]!=0){
      count[a[i]]=2;
      continue;
    }
    for(int i=a[i];i<1000005;i+=a[i]) count[i]++;
  }
  int ans=0;
  for(int i=1;i<=n;i++){
    if(count[i]==1) ans++;
  }

  printf("%d",ans);
  return 0;
}
//  [javascript]
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(String(myOut));

function main(){
  var n = next();
  var b = xArray(0,1e6+1);
  for(var i = 0; i < n; i++){
    var a = next();
    b[a]++;
  }
  var ans = 0;
  for(var i = 1; i <= 1e6; i++){
    if(b[i] === 0)continue;
    if(b[i] === 1)ans++;
    for(var j = i+i; j <= 1e6; j+=i)b[j] = 0;
  }
  return ans;
}
//  [javascript]
function main(input) {
  const a = input[1].trim().split(" ").map(i => parseInt(i));

  const a_max = 10**6+1;

  const dp = new Array(a_max+1).fill(0);
  for(let i of a){
    dp[i]++;
  }

  for(let i=1;i<=a_max;i++){
    if(dp[i]===0){ 
      continue;
    }
    for(let j=i+i;j<=a_max;j=j+i){
      if(dp[j]!==0){
        dp[j]=0;
      }
    }
  }
  console.log(dp.filter(function(x){return x===1}).length);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));
//  [javascript]
const input = require("fs").readFileSync("/dev/stdin", "utf8")
let cin = input.split(/ |\n/), cid = 0
const next = () => cin[cid++]
const nexts = (n) => cin.slice(cid, cid+=n).map(i=>parseInt(i))
const xArray = (n, v) => [...Array(n)].fill(v)

const N = parseInt(next())
let array = xArray(1e6+1, 0)
for (let i = 0; i < N; i++) {
    a = next()
    array[a]++
}
let ans = 0
for (let i = 0; i <= 1e6; i++) {
    if(array[i] === 0) continue;
    if(array[i] === 1) ans++;
    for (let j = i + i; j <= 1e6; j+=i) {
        array[j] = 0
    }
}
console.log(ans)
//  [javascript]
const main = (input) => {
  input = input.trim().split('\n')

  const n = input[1].split(' ').map(Number).sort((a, b) => a - b)
  const arr = new Array(parseInt(input[0], 10)+1).fill(false)
  const biggest = n[n.length-1]

  if (Array.from(new Set(n)).length === 1) return console.log(0)

  let ans = 0

  for (let i=0; i<n.length; i++) {
    if ((n[i-1] && n[i-1] === n[i]) || (n[i+1] && n[i+1] === n[i])) {}
    else if (!arr[n[i]]) ans++

    for (let m=2; n[i] * m <= biggest; m++) arr[n[i] * m] = true
  }

  return console.log(ans)
}

process.env.MYTEST
  ? (process.env.MYTEST === 'test' ? test() : main(require('fs').readFileSync('dev/stdin', 'utf8')))
  : main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [javascript]
const main = (input) => {
  input = input.trim().split('\n')

  const n = input[1].split(' ').map(Number).sort((a, b) => a - b)
  const arr = new Array(parseInt(input[0], 10)+1).fill(false)
  const biggest = n[n.length-1]

  if (Array.from(new Set(n)).length === 1) return 0

  let ans = 0

  for (let i=0; i<n.length; i++) {
    if ((n[i-1] && n[i-1] === n[i]) || (n[i+1] && n[i+1] === n[i])) {}
    else if (!arr[n[i]]) ans++

    for (let m=2; n[i] * m <= biggest; m++) arr[n[i] * m] = true
  }

  return console.log(ans)
}

process.env.MYTEST
  ? (process.env.MYTEST === 'test' ? test() : main(require('fs').readFileSync('dev/stdin', 'utf8')))
  : main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [javascript]
const main = (input) => {
  input = input.trim().split('\n')
  const n = input[1].split(' ').map(Number).sort((a, b) => a - b)

  const biggest = n[n.length-1]
  const arr = new Array(parseInt(input[0], 10)+1).fill(false)

  let ans = 0

  for (let i=0; i<n.length; i++) {
    const num = n[i]
    if ((n[i-1] && n[i-1] === n[i]) || (n[i+1] && n[i+1] === n[i])) {}
    else if (!arr[num]) ans++

    for (let m=2; num * m <= biggest; m++) arr[num * m] = true
  }

  return console.log(ans)
}

process.env.MYTEST
  ? (process.env.MYTEST === 'test' ? test() : main(require('fs').readFileSync('dev/stdin', 'utf8')))
  : main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [go]
package main

import (
	"fmt"
	"io"
	"os"
)

func main() {
	sc := NewScanner(os.Stdin)
	n := sc.Int()
	a := make([]int, n)

	var max int
	for i := 0; i < n; i++ {
		a[i] = sc.Int()
		if a[i] > max {
			max = a[i]
		}
	}

	dp := make([]int, max+1)

	for _, n := range a {
		dp[n]++
		if dp[n] > 1 {
			continue
		}

		for v := n + n; v <= max; v += n {
			dp[v]++
		}
	}

	var count int
	for _, v := range a {
		if dp[v] == 1 {
			count++
		}
	}
	fmt.Println(count)
}

type Scanner struct {
	r     io.Reader
	buf   []byte
	delim byte
	size, eof,
	start, end int
}

func NewScanner(r io.Reader) *Scanner { return NewScannerSize(r, 4096) }
func NewScannerSize(r io.Reader, size int) *Scanner {
	return &Scanner{
		r:     r,
		buf:   make([]byte, size),
		delim: ' ',
		size:  size, start: size, end: size,
	}
}

func (s *Scanner) Int() int { return ParseInt(s.bytes()) }

func (s *Scanner) bytes() []byte { b, _ := s.next(); return b }
func (s *Scanner) next() (b []byte, size int) {
	for n := 0; ; {
		for i := s.end; i < s.size; i++ {
			if s.buf[i] == s.delim || s.buf[i] == '\n' || i == s.eof {
				b, size = s.buf[s.start:i], i-s.start
				s.start, s.end = i+1, i+1
				return
			}
		}
		s.end = s.size
		if n++; n == 2 {
			panic("lack of buffer size")
		}
		s.read()
	}
}
func (s *Scanner) read() {
	copy(s.buf, s.buf[s.start:s.end])
	s.end -= s.start
	s.start = 0
	n, _ := s.r.Read(s.buf[s.end:])
	s.eof = s.end + n
}

func ParseInt(b []byte) (n int) {
	var i int
	if b[0] == '-' {
		i++
	}
	for ; i < len(b); i++ {
		n *= 10
		n += int(b[i] - '0')
	}
	if b[0] == '-' {
		return -n
	}
	return
}
//  [go]
package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

func main() {
	sc := NewScanner(os.Stdin)
	n, _ := sc.NextInt()
	a, _ := sc.NextInts(n)
	fmt.Println(solve(n, a))
}

func solve(n int, a []int) (ans int) {
	max := Max(a...)
	divisorCount := make([]int, max+1)

	for _, ai := range a {
		for j := ai; j <= max; j += ai {
			divisorCount[j]++
		}
	}

	for _, ai := range a {
		if divisorCount[ai] == 1 {
			ans++
		}
	}

	return ans
}

// Max returns max value of inputs
func Max(a ...int) (max int) {
	for i, ai := range a {
		if i == 0 || ai > max {
			max = ai
		}
	}
	return max
}

// Scanner is a wrapper of bufio.Scanner which is customized for competitive programing.
type Scanner struct {
	bufio.Scanner
}

// NewScanner is a constructor for Scanner.
func NewScanner(r io.Reader) *Scanner {
	sc := Scanner{*bufio.NewScanner(r)}
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
	return &sc
}

// NextInt reads a integer from io stream.
func (sc *Scanner) NextInt() (int, error) {
	if !sc.Scan() {
		return -1, errors.New("failed to scan")
	}
	return strconv.Atoi(sc.Text())
}

// NextInts reads n integers from io stream.
func (sc *Scanner) NextInts(n int) (arr []int, e error) {
	arr = make([]int, n)
	for i := 0; i < n; i++ {
		v, e := sc.NextInt()
		if e != nil {
			return nil, e
		}
		arr[i] = v
	}
	return arr, nil
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	defaultBufferSize = 1024
	maxBufferSize     = 1e6
	Mod               = 1e9 + 7
)

var sc = bufio.NewScanner(os.Stdin)

// sc.Buffer(make([]byte, defaultBufferSize), maxBufferSize)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func readString() string {
	sc.Scan()
	return sc.Text()
}

func readInt64() int64 {
	sc.Scan()
	i, err := strconv.ParseInt(sc.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return int64(i)
}

func readfloat64() float64 {
	sc.Scan()
	f, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

func abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func ModComb(n, k int) int {
	if k == 0 {
		return 1
	}
	x, y := n, k
	for i := 1; i < k; i++ {
		x = x * (n - i) % Mod
		y = y * (k - i) % Mod
	}
	inv := ModInv(y)
	return x * inv % Mod
}

func ModFact(x int) int {
	fact := 1
	for i := 1; i <= x; i++ {
		fact = fact * i % Mod
	}
	return fact
}

func ModInv(x int) int {
	return ModPow(x, Mod-2)
}

func ModPow(a, n int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % Mod
		}
		a = a * a % Mod
		n /= 2
	}
	return res
}

func pow(a, n int) int {
	if n == 0 {
		return 1
	}

	ans := 0
	if n%2 == 0 {
		ans = pow(a*a, n/2)
	} else {
		ans = a * pow(a*a, (n-1)/2)
	}
	return ans
}

func intSliceReverse(slice []int) []int {
	for i, j := 0, len(slice)-1; i < j; i, j = i+1, j-1 {
		slice[i], slice[j] = slice[j], slice[i]
	}
	return slice
}

func stringReverse(str string) string {
	runes := []rune(str)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func primeFactorization(x int) map[int]int {
	result := make(map[int]int, 0)
	for i := 2; i*i <= x; i++ {
		for x%i == 0 {
			result[i]++
			fmt.Println(x)

			x /= i
		}
	}
	if x != 1 {
		result[x]++
		fmt.Println(x)
	}
	return result
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	for i := 2; i*i <= x; i++ {
		if i == x {
			continue
		}
		if x%i == 0 {
			return false
		}
	}
	return true
}

func main() {
	sc.Split(bufio.ScanWords)
	n := readInt()

	a := make([]int, n)
	max := 0
	for i := 0; i < n; i++ {
		a[i] = readInt()
		if a[i] > max {
			max = a[i]
		}
	}
	count := make([]int, max+1)

	for _, ai := range a {
		for j := ai; j <= max; j += ai {
			count[j]++
		}
	}

	ans := 0
	for _, ai := range a {
		if count[ai] == 1 {
			ans++
		}
	}
	fmt.Println(ans)
}
//  [go]
package main

import (
	"bufio"
	"flag"
	"fmt"
	"os"
	"sort"
	"strconv"
	"testing"
)

/*-----------Main-----------*/

func main() {
	n := readI()
	a := readIs(n)
	sort.Ints(a)
	del := make([]bool, n)

	for i := 0; i < n; i++ {
		if del[i] {
			continue
		}
		for j := i + 1; j < n; j++ {
			if del[j] {
				continue
			}
			if a[j] == a[i] {
				del[i], del[j] = true, true
			} else if a[j]%a[i] == 0 {
				del[j] = true
			}
		}
	}
	ans := 0
	for i := 0; i < n; i++ {
		if !del[i] {
			ans++
		}
	}
	fmt.Println(ans)
}

/*-----------Utilities-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	testing.Init()
	if flag.Parse(); flag.Arg(0) == "debug" {
		debug()
	}
	const maxBuf = 200100
	var buf []byte = make([]byte, maxBuf)
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBuf)
}

func debug() {
	testFile, err := os.Open("./test/sample-3.in")
	if err != nil {
		fmt.Println("Error : There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

func readS() string {
	sc.Scan()
	return sc.Text()
}

func readSs(a int) []string {
	b := make([]string, a)
	for i := 0; i < a; i++ {
		b[i] = readS()
	}
	return b
}

func readI() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

func readIs(a int) []int {
	b := make([]int, a)
	for i := 0; i < a; i++ {
		b[i] = readI()
	}
	return b
}

func readF() float64 {
	sc.Scan()
	r, _ := strconv.ParseFloat(sc.Text(), 64)
	return r
}

func readFs(a int) []float64 {
	b := make([]float64, a)
	for i := 0; i < a; i++ {
		b[i] = readF()
	}
	return b
}

func max(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] > m {
			m = a[i]
		}
	}
	return m
}

func min(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] < m {
			m = a[i]
		}
	}
	return m
}

func sortI(a []int) []int {
	sort.Ints(a)
	return a
}

func reverse(a []int) []int {
	l := len(a)
	r := make([]int, l)
	for i := 0; i < l; i++ {
		r[i] = a[l-i-1]
	}
	return r
}

func countI(a []int, b int) int {
	l := len(a)
	var c int
	for i := 0; i < l; i++ {
		if a[i] == b {
			c++
		}
	}
	return c
}
//  [go]
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)

	a := make([]int, n)
	for i := 0; i < len(a); i++{
		fmt.Scanf("%d", &a[i])
	}
	sort.Ints(a)

	b := make([]bool, n)
	for i := 0; i < len(b); i++ {
		b[i] = true
	}

	for i := 0; i < len(a) - 1; i++ {
		if !b[i] {
			continue
		}

		for j := i + 1; j < len(a); j++ {
			if !b[j] {
				continue
			}

			if a[i] == a[j] {
				b[i] = false
			}
			if a[j] % a[i] == 0 {
				b[j] = false
			} 
		}
	}

	ans := 0
	for i := 0; i < len(b); i++ {
		if b[i] {
			ans = ans + 1
		}
	}

	fmt.Println(ans)
}
//  [go]
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)

	a := make([]int, n)
	for i := 0; i < len(a); i++{
		fmt.Scanf("%d", &a[i])
	}
	sort.Ints(a)

	b := make([]bool, n)
	for i := 0; i < len(b); i++ {
		b[i] = true
	}

	for i := 0; i < len(a) - 1; i++ {
		if !b[i] {
			continue
		}

		for j := i + 1; j < len(a); j++ {
			if a[i] == a[j] {
				b[i] = false
			}
			if a[j] % a[i] == 0 {
				b[j] = false
			} 
		}
	}

	ans := 0
	for i := 0; i < len(b); i++ {
		if b[i] {
			ans = ans + 1
		}
	}

	fmt.Println(ans)
}
//  [ruby]
gets
a = gets.split.map(&:to_i).sort
max = 10 ** 6
f = Array.new(max + 1, 0)
d = Array.new(max + 1, 0)
ans = 0
a.each{|n|
	if d[n] == 1
		ans -= 1
		d[n] = 0
	end
	if f[n] == 1
		next
	end
	ans += 1
	t = n
	j = 1
	while t <= max
		f[t] = 1
		t += n
	end
	d[n] = 1
}
puts ans
//  [ruby]
n = gets.to_i
a = gets.split.map(&:to_i).sort
max = a[-1]
r = Array.new(max+1, true)
for i in 0...n
  if r[a[i]]
    r[a[i]] = false if a[i] == a[i+1]
    t = a[i]*2
    while t <= max
      r[t] = false
      t += a[i]
    end
  end
end
s = 0
a.each do |i|
  s += 1 if r[i]
end
p s
//  [ruby]
n = gets.to_s.to_i
a = gets.to_s.split.map{|t|t.to_i}.sort

if n == 1 || (a[0] == 1 && a[1] != 1)
  puts 1
  exit
elsif a[0] == 1 && a[1] == 1
  puts 0
  exit
end

MAX_A = a[-1]
hantei = [true] * ( MAX_A + 1 )

a.each_with_index do |t, i|
  
  if hantei[t]
    
    hantei[t] = false if t == a[i+1]

    s = t + t
    while s <= MAX_A
      hantei[s] = false
      s += t
    end
  end
end

ans = 0
a.each do |t|
  ans += 1 if hantei[t]
end

puts ans
//  [ruby]
n = gets.to_i
arr = gets.to_s.split.map(&:to_i)

max = arr.max
hash = {}
arr.each do |num|
  hash[num] = hash[num].nil? ? true : false
  (2..max).each do |i|
    if num * i > max
      p [num, i]
      break
    end
    hash[num * i] = false
  end
end

count = 0
hash.each do |_num, bool|
  count += 1 if bool
end
puts count
//  [ruby]
n = gets.to_i
arr = gets.to_s.split.map(&:to_i)

max = arr.max
hash = {}
arr.each do |num|
  p num
  hash[num] = hash[num].nil? ? true : false
  (2..max).each do |i|
    if num * i > max
      p [num, i]
      break
    end
    hash[num * i] = false
  end
end

count = 0
hash.each do |_num, bool|
  count += 1 if bool
end
puts count
//  [ruby]
n = gets.to_i
arr = gets.to_s.split.map(&:to_i).sort

p_arr = []
dup = {}
arr.each do |num|
  flag = true
  p_arr.each do |m|
    if m == num
      dup[num] ||= true
      flag = false
      break
    elsif num % m == 0
      flag = false
      break
    end
  end
  p_arr << num if flag
end

puts p_arr.length - dup.keys.length
//  [rust]
use proconio::*;
use std::collections::*;

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [usize; n],
    }

    let mut ok = vec![false; 1000001];
    let mut cnt = vec![0; 1000001];
    for b in a {
        ok[b] = true;
        cnt[b] += 1;
    }

    let mut ans = 0;
    for i in 0..=1000000 {
        if !ok[i] {
            continue;
        }
        if cnt[i] == 1 {
            ans += 1;
        }
        for j in 2.. {
            if i * j > 1000000 {
                break;
            }
            ok[i * j] = false;
        }
    }

    println!("{}", ans);
}
//  [rust]
use proconio::*;

fn run() {
    input! {
        n: usize,
        a: [usize; n],
    }
    let m = 1000000;
    let mut cnt = vec![0; m + 1];
    for a in a {
        cnt[a] += 1;
    }
    let mut ans = 0;
    for i in 1..=m {
        if cnt[i] == 0 {
            continue;
        }
        if cnt[i] == 1 {
            ans += 1;
        }
        let mut j = i;
        while let Some(c) = cnt.get_mut(j) {
            *c = 0;
            j += i;
        }
    }
    println!("{}", ans);
}

fn main() {
    run();
}
//  [rust]
macro_rules !read_value {($iter :expr ,($($t :tt ) ,*) ) =>{($(read_value !($iter ,$t ) ) ,*) } ;($iter :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($iter ,$t ) ) .collect ::<Vec <_ >>() } ;($iter :expr ,{$t :tt =>$f :expr } ) =>{$f (read_value !($iter ,$t ) ) } ;($iter :expr ,chars ) =>{read_value !($iter ,String ) .chars () .collect ::<Vec <char >>() } ;($iter :expr ,usize1 ) =>{read_value !($iter ,usize ) -1 } ;($iter :expr ,$t :ty ) =>{$iter .next () .unwrap () .parse ::<$t >() .unwrap () } ;}
macro_rules !input_inner {($iter :expr ) =>{} ;($iter :expr ,) =>{} ;($iter :expr ,mut $var :ident :$t :tt $($r :tt ) *) =>{let mut $var =read_value !($iter ,$t ) ;input_inner !{$iter $($r ) *} } ;($iter :expr ,mut $var :ident $($r :tt ) *) =>{input_inner !{$iter ,mut $var :usize $($r ) *} } ;($iter :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($iter ,$t ) ;input_inner !{$iter $($r ) *} } ;($iter :expr ,$var :ident $($r :tt ) *) =>{input_inner !{$iter ,$var :usize $($r ) *} } ;}
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;(iter =$iter :ident ,$($r :tt ) *) =>{let s ={use std ::io ::Read ;let mut s =String ::new () ;std ::io ::stdin () .read_to_string (&mut s ) .unwrap () ;s } ;let mut $iter =s .split_whitespace () ;input_inner !{$iter ,$($r ) *} } ;($($r :tt ) *) =>{let s ={use std ::io ::Read ;let mut s =String ::new () ;std ::io ::stdin () .read_to_string (&mut s ) .unwrap () ;s } ;let mut iter =s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;}
fn main() {
    #[allow(unused_imports)]
    use std::io::Write as _;
    let __out = std::io::stdout();
    #[allow(unused_mut, unused_variables)]
    let mut __out = std::io::BufWriter::new(__out.lock());
    #[allow(unused_macros)]
    macro_rules !print {($($arg :tt ) *) =>(::std ::write !(__out ,$($arg ) *) .unwrap () ) }
    #[allow(unused_macros)]
    macro_rules !println {($($arg :tt ) *) =>(::std ::writeln !(__out ,$($arg ) *) .unwrap () ) }
    #[allow(unused_macros)]
    macro_rules! echo {
        ($iter :expr ) => {
            echo!($iter, "\n")
        };
        ($iter :expr ,$sep :expr ) => {
            let mut iter = $iter;
            if let Some(item) = iter.next() {
                print!("{}", item);
            }
            for item in iter {
                print!("{}{}", $sep, item);
            }
            println!();
        };
    }
    input!(n, a: [usize; n]);
    let mut c = vec![0; 1_001_001];
    for &x in a.iter() {
        c[x] += 1;
    }
    let mut x = vec![true; 1_001_001];
    x[0] = false;
    let mut ans = 0;
    for i in 1..1_000_001 {
        if x[i] && c[i] > 0 {
            if c[i] == 1 {
                ans += c[i];
            }
            for j in (i * 2..1_000_001).step_by(i) {
                x[j] = false;
            }
        }
    }
    println!("{}", ans);
}
//  [swift]
class Scanner {
    private var stack = [String]()
    private var index = 0
    
    func peek() -> String {
        if stack.count == index {
            stack += readLine()!.split(separator: " ").map{ String($0) }
        }
        return stack[index]
    }
    
    func next() -> String {
        let value = peek()
        index += 1
        return value
    }
    
    func nextInt() -> Int {
        return Int(next())!
    }
    
    func nextDouble() -> Double {
        return Double(next())!
    }
}

var scanner = Scanner()

let N = scanner.nextInt()
let A = (0 ..< N).map { _ in scanner.nextInt() }

var count = [Int](repeating: 0, count: 1000001)

for x in A {
    count[x] += 1
}

var answer = 0
for i in 1 ... 1000000 {
    if count[i] == 1 {
        answer += 1
    }
    if count[i] > 0 {
        for j in stride(from: i, through: 1000000, by: i) {
            count[j] = 0
        }
    }
}

print(answer)
//  [swift]
let N = Int(readLine()!)!
let A: [Int] = readLine()!.split(separator: " ").map { Int($0)! }.sorted()

var dp: [Bool] = Array(repeating: true, count: 3*Int(1e6))
var x: Int = -1
for a in A {
    if x == a { continue }
    x = a
    while x <= A[N-1] {
        x += a
        dp[x] = false
    }
    x = a
}

var res: Int = 0
for (i, a) in A.enumerated() {
    if i > 0 && a == A[i-1] { continue }
    if i < N-1 && a == A[i+1] { continue }
    if dp[a] { res += 1 }
}
print(res)  // (๑•ૅㅁ•๑)
//  [swift]
import Foundation

func readInt() -> Int {
    return Int(readLine()!)!
}

func readInts(separator: String.Element = " ") -> [Int] {
    return readLine()!.split(separator: separator).map { Int($0)! }
}

func readTwoInts(separator: String.Element = " ") -> (a: Int, b: Int) {
    let ints = readLine()!.split(separator: separator).map { Int($0)! }
    return (a: ints[0], b: ints[1])
}

extension Int {

    // 約数
    var divisors: [Int] {
        var divisors: [Int] = []

        // √Nまで
        for number in 1...Int(sqrt(Double(self))) {
            if self % number == 0 {
                divisors.append(number)

                // N / aが割り切れる場合、N / aも約数
                if self.isMultiple(of: number), self / number != number {
                    divisors.append(self / number)
                }
            }
        }

//        divisors.sort(by: <)

        return divisors
    }
}

func mainD() {
    let N = readInt()
    let numbers = readInts()

    // 各数字があるかないかを表す配列
    var exists: [Bool] = .init(repeating: false, count: 1_000_000 + 1)
    // 重複
    var doubleExists: [Bool] = .init(repeating: false, count: 1_000_000 + 1)

    for number in numbers {
        if exists[number] {
            doubleExists[number] = true
            continue
        }

        exists[number] = true
    }

    var count = 0
    for number in numbers {
        if doubleExists[number] {
            continue
        }

        var answer = true

        // 約数で自分以外
        var divisors = number.divisors
        if divisors.count > 1 {
            divisors.remove(at: 1)
        }

        for divisor in divisors {
            if exists[divisor] {
                answer = false
                break
            }
        }

        if answer {
            count += 1
        }
    }

    print(count)
}
mainD()
//  [swift]
import Foundation

func readInt() -> Int {
    return Int(readLine()!)!
}

func readInts(separator: String.Element = " ") -> [Int] {
    return readLine()!.split(separator: separator).map { Int($0)! }
}

func readTwoInts(separator: String.Element = " ") -> (a: Int, b: Int) {
    let ints = readLine()!.split(separator: separator).map { Int($0)! }
    return (a: ints[0], b: ints[1])
}

extension Int {

    // 約数
    var divisors: [Int] {
        var divisors: [Int] = []

        // √Nまで
        for number in 1...Int(sqrt(Double(self))) {
            if self % number == 0 {
                divisors.append(number)

                // N / aが割り切れる場合、N / aも約数
                if self.isMultiple(of: number), self / number != number {
                    divisors.append(self / number)
                }
            }
        }

//        divisors.sort(by: <)

        return divisors
    }
}

func mainD() {
    let N = readInt()
    let numbers = readInts()

    // 各数字があるかないかを表す配列
    var exists: [Bool] = .init(repeating: false, count: 1_000_000 + 1)
    // 重複
    var doubleExists: [Bool] = .init(repeating: false, count: 1_000_000 + 1)

    for number in numbers {
        if exists[number] {
            doubleExists[number] = true
            continue
        }

        exists[number] = true
    }

    var count = 0
    for number in numbers {
        if doubleExists[number] {
            continue
        }

        var answer = true

        // 約数で自分以外
        var divisors = number.divisors
        divisors.remove(at: 1)

        for divisor in divisors {
            if exists[divisor] {
                answer = false
                break
            }
        }

        if answer {
            count += 1
        }
    }

    print(count)
}
mainD()
//  [swift]
import Foundation

func readInt() -> Int {
    return Int(readLine()!)!
}

func readInts(separator: String.Element = " ") -> [Int] {
    return readLine()!.split(separator: separator).map { Int($0)! }
}

func readTwoInts(separator: String.Element = " ") -> (a: Int, b: Int) {
    let ints = readLine()!.split(separator: separator).map { Int($0)! }
    return (a: ints[0], b: ints[1])
}

extension Int {

    // 約数
    var divisors: [Int] {
        var divisors: [Int] = []

        // √Nまで
        for number in 1...Int(sqrt(Double(self))) {
            if self % number == 0 {
                divisors.append(number)

                // N / aが割り切れる場合、N / aも約数
                if self.isMultiple(of: number), self / number != number {
                    divisors.append(self / number)
                }
            }
        }

//        divisors.sort(by: <)

        return divisors
    }
}

func mainD() {
    let N = readInt()
    let numbers = readInts()

    // 各数字があるかないかを表す配列
    var exists: [Bool] = .init(repeating: false, count: 1_000_000 + 1)
    // 重複
    var doubleExists: [Bool] = .init(repeating: false, count: 1_000_000 + 1)

    for number in numbers {
        if exists[number] {
            doubleExists[number] = true
            continue
        }

        exists[number] = true
    }

    var count = 0
    for number in numbers {
        if doubleExists[number] {
            continue
        }

        var answer = true

        // 約数で自分以外
        var divisors = number.divisors
        divisors.removeLast()

        for divisor in divisors {
            if exists[divisor] {
                answer = false
                break
            }
        }

        if answer {
            count += 1
        }
    }

    print(count)
}
mainD()
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const A = input[1].map(Number);
  const MAX = 10 ** 6;

  const divisorCounts: Array<number | undefined> = [];

  A.forEach((a) => {
    if (divisorCounts[a] !== undefined) {
      divisorCounts[a] = 2;

      return;
    }

    for (let i = a; i <= MAX; i += a) {
      divisorCounts[i] = (divisorCounts[i] || 0) + 1;
    }
  });

  let answer = 0;
  A.forEach((a) => {
    if (divisorCounts[a] === 1) {
      answer += 1;
    }
  });

  return answer;
};

console.log(main(read()));