peterverebics/CodeNet_Python_118 huggingface dataset:
from collections import Counter
import numpy as np

A_MAX = 10 ** 6 + 1

N = int(input())
A = Counter(list(map(int, input().split(' '))))

dp = np.zeros(shape=A_MAX, dtype=np.int64)

if A[1] == 1:
    print(1)
elif A[1] > 1:
    print(0)
else:
    for a in A.keys():
        multiples = np.arange(a, A_MAX, a)
        np.add.at(dp, multiples, 1)

    ans = 0
    for a, count in A.items():
        if count > 1:
            continue
        if dp[a] == 1:
            ans += 1

    print(ans)
from collections import Counter
n = int(input())
a = [int(i) for i in input().split()]
mx = max(a)
flag = [True]*(mx+1)
c = Counter(a)
a.sort()
ans = 0
for i in range(n):
    if flag[a[i]]:
        if c[a[i]] == 1: ans += 1
        for j in range(2*a[i],mx+1,a[i]): flag[j] = False
print(ans)
import collections
N = int(input())
A = sorted([int(i) for i in input().split()])
C = collections.Counter(A)
tested = [True for i in range(10**7+1)]

ans = 0
for i in range(N):
    if tested[A[i]] is True:
        for j in range(A[i], 10**6+1, A[i]):
            tested[j] = False
        if C[A[i]] == 1:
            ans += 1
print(ans)
n = int(input())
a = list(map(int, input().split()))
a.sort()
MAX = a[-1]
l = [0]*(MAX+1)
for i in range(n):
    l[a[i]] += 1

ans = 0
for i in range(n):
    if l[a[i]] == 1:
        ans += 1
    for g in range(a[i], MAX+1, a[i]):
        l[g] = 10

print(ans)
n = int(input())
a_list = sorted(map(int, input().split()))

max_num = max(a_list)

is_ans = [False]*(max_num+1)
memo = [0]*(max_num+1)
for i in a_list:
    is_ans[i] = True
    memo[i] += 1

for i in range(1, max_num+1):
    if is_ans[i]:
        for j in range(2*i, max_num+1, i):
                is_ans[j] = False

    if memo[i] > 1:
        is_ans[i] = False

ans = is_ans.count(True)
print(ans)
N = int(input())
A = list(map(int, input().split()))
M = max(A)
memo = [0]*(M+1)
i = 0
while i < N:
  a = A[i]
  memo[a] += 1
  x = a+a
  while x <= M:
    memo[x] += 2
    x += a
  i += 1
print(sum([1 if m == 1 else 0 for m in memo]))
n = int(input())
ls = sorted(list(map(int, input().split())))
dp = [0] * (ls[-1] + 1)
for i in ls:
    dp[i] += 1
    if dp[i] == 1:
        for j in range(i*2, ls[-1] + 1, i):
            dp[j] += 2

print(dp.count(1))
n = int(input())
a = list(map(int, input().split()))

ok = [True]*1000005

a.sort()
ans=0
for i in range(n):
    if i<n-1 and a[i]!=a[i+1] and ok[a[i]]:
        ans+=1
    elif i==n-1 and ok[a[i]]:
        ans+=1
    if ok[a[i]]:
        for j in range(a[i],1000004,a[i]):
            ok[j]=False

print(ans)
from collections import Counter

N = int(input())
X = list(map(int, input().split()))


lim = 10 ** 6 + 10
ok = [True] * (lim + 1)
ans = 0
ctr = Counter(X)
for n in sorted(X):
    if ok[n]:
        if ctr[n] == 1:
            ans += 1
        for j in range(n, lim + 1, n):
            ok[j] = False

print(ans)
from sys import stdin

import numpy as np

U = 10 ** 6 + 10


def main():
    readline = stdin.readline
    N = int(readline())
    a = list(map(int, readline().split()))
    ret = 0
    exist_counts = [0] * U
    for x in a:
        if exist_counts[x]:
            exist_counts[x] = 2
            continue
        idx = x
        while idx < U:
            exist_counts[idx] += 1
            idx += x
    for x in a:
        ret += exist_counts[x] == 1
    print(ret)
main()
n = int(input())
a = sorted(list(map(int,input().split())))
maxa = max(a)+1
dp = [0]*maxa

for i in a:
    dp[i] += 1
    if dp[i] == 1:
        for j in range(2*i,maxa,i):
            dp[j] += 2
print(dp.count(1))
n = int(input())
a = sorted(list(map(int, input().split())))
max = a[-1]
memo = ['Yes'] * (10**6+1)
ans = 0

for i, a_i in enumerate(a):
    if memo[a_i] == 'No':
        continue
    for j in range(a_i, max+1, a_i):
        memo[j] = 'No'
    if i != n-1 and a_i == a[i+1]:
        continue
    ans += 1

print(ans)
n = int(input())
*a, = sorted(map(int, input().split()))
a_max = a[n-1]
dp = [True] * a_max
ans = 0
recent = 0

if n == 1:
    print(1)
    exit()

for i in a:
    if recent == i:
        ans -= 1
        recent = 0
    if dp[i-1] == False:
        continue
    else:
        for j in range(i, a_max+1, i):
            dp[j-1] = False
        ans += 1
        recent = i

print(ans)
from sys import stdin,stdout
from collections import Counter
n=int(stdin.readline())
a=sorted(map(int,stdin.readline().split()))
d=Counter(a)
m1=max(a);ans=0
vis=[0]*(m1+1)
for v in a:
    if not vis[v]:
        if d[v]==1:ans+=1
        for mul in range(v,m1+1,v):
            vis[mul]=1
stdout.write(str(ans))
n = int(input())

a = [int(x) for x in input().split()]

baisuu=[0]*(10**6+1)

for i in a:
	if baisuu[i]>=1:
		baisuu[i]=2
		continue

	for j in range(i,10**6+1,i):
		baisuu[j]+=1

ans=0

for i in a:
	if baisuu[i]==1:
		ans+=1

print(ans)
M=10**6+1
_,*l=map(int,open(0).read().split())
b=[0]*M
for i in l: b[i]+=1
a=[]
for i in sorted(l):
  if b[i]:
    if b[i]==1: a+=[i]
    for j in range(i,M,i): b[j]=0
print(len(a))
from collections import Counter
def i(): return int(input())
def l(): return list(map(int,input().split()))

N = i();A = l()
A.sort()
dp = [1]*(10**6+1)
C = Counter(A)
ans = 0
for a,b in C.items():
    if b != 1:dp[a] = 0
    elif dp[a]:ans += 1
    for j in range(a,10**6+1,a):dp[j] = 0
print(ans)
import numpy as np

n = int(input())
a = list(map(int, input().split()))
MAX = 10 ** 6

arr = np.zeros(MAX + 1, np.int64)
for e in a:
    arr[e] += 1

for i in range(MAX + 1):
    if arr[i]:
        arr[2*i::i] = 0

    arr[i] = arr[i] == 1

ans = arr.sum()
print(ans)
N = int(input())
A = list(map(int, input().split()))
A.sort()
dp = [True] * (A[-1]+1)

for i,num in enumerate(A):
    if i < N-1 and A[i+1] == num:
        dp[num] = False
    for j in range(2*num, A[-1]+1, num):
        dp[j] = False

print(len([i for i in A if dp[i]]))
from sys import stdin
input = stdin.readline

n = int(input())
A = list(map(int, input().split()))

A.sort()

is_ok = [False] * (10 ** 6 + 1)
is_exist = [False] * (10 ** 6 + 1)

for a in A:
    if is_exist[a]:
        is_ok[a] = False
    else:
        is_exist[a] = True
        is_ok[a] = True
        for i in range(1, 10 ** 6 // a + 1):
            if a * i <= 10 ** 6:
                is_exist[a * i] = True

print(is_ok.count(True))
n = int(input())
a = sorted(list(map(int,input().split())))
a_max = a[-1]
dp = [0]*(a_max+1)

for i in a:
    dp[i] += 1
    if dp[i] == 1:
        for j in range(i*2,a_max+1,i):
            dp[j] = 2
print(dp.count(1))
from math import sqrt
from collections import Counter


def main():
    N = int(input())
    A = list(map(int, input().split()))

    ans = 0
    p = [0] * (10**6 + 1)
    c = Counter(A)

    for a in c.keys():
        tmp = a * 2
        while tmp <= 10**6:
            p[tmp] = 1
            tmp += a

    for a in A:
        if p[a] == 0 and c[a] == 1:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()
N = int(input())
A = [int(i) for i in input().split()]
A.sort()
B = [True]*(A[-1]+1)
i = 0
for i in range(N):
  if i < N-1 and A[i] == A[i+1]:
    B[A[i]] = False
  if A[-1] < 2*A[i]:
    continue
  M = A[-1]//A[i]+1
  for j in range(2,M):
    B[j*A[i]] = False

ans = 0
for a in A:
  if B[a]:
    ans += 1
print(ans)
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
cntA = Counter(A)

A.sort()
V = set()

ans = 0
mx = max(A)
for a in A:
    if a in V:
        continue
    if cntA[a] == 1:
        ans += 1

    p = a
    while p <= mx:
        V.add(p)
        p += a

print(ans)
N = int(input())
As = list(map(int, input().split()))
 
As.sort()
 
st = set(As)
m = As[-1]
rlt = 0
Fs = [1]*(m+1)
 
for i in range(N):
  if i > 0 and As[i] == As[i-1]:
    Fs[As[i]] = 0
    continue
  j = 2
  while As[i]*j <= m:
    Fs[As[i]*j] = 0
    j += 1

for a in As:
  rlt += Fs[a]
    
print(rlt)
N = int(input())
Alist = [int(x) for x in input().split()]
M = max(Alist)
A0 = ['NotUse']
Abool = A0 + [0 for x in range(M)]
Alist.sort()
ans = 0

for i in Alist:
    for j in range(i,M+1,i):
        if Abool[j] >= 2:
            None
        else:
            Abool[j] += 1
    
for i in Alist:
    if Abool[i] == 1:
        ans += 1
print(ans)
N = int(input())
A = list(map(int,input().split()))

D = [0] * (10**6 + 1)
A.sort()
for i in range(N):
    D[A[i]] += 1
    
ans = 0
for i in range(1, 10**6+1):
    if D[i]:
        if D[i]==1:
            ans += 1
        for j in range(i,A[-1]+1,i):
            D[j] = 0
print(ans)
n=int(input())
a=list(map(int, input().split()))
cnt=[0]*((10**6)+1)
unique=[]

for num in a:
    cnt[num]+=1

for i in range(10**6 +1):
    if cnt[i]==1:
        unique.append(i)

table=[0]*((10**6)+1)
a=list(set(a))

for elem in a:
    for i in range(2*elem, 10**6 +1, elem):
        table[i]=1

ans=0

for elem in unique:
    if table[elem]==0:
        ans+=1

print(ans)
n=int(input())
a=list(map(int,input().split()))
M=max(a)
num=[0]*M
for x in a:
	num[x-1]+=1
for i in range(M):
	if num[i]>=2:
		num[i]=2
ret=num.copy()
for i in range(M):
	if num[i]:
		j=i+i+1
		while j<M:
			ret[j]=0 
			j+=i+1
	if num[i]==2:
		ret[i]=0
print(ret.count(1))
n=int(input())
A=list(map(int,input().split()))
A.sort()
M=10**6+1
cnt=[0]*M
for i in A:
    if cnt[i]!=0:
        cnt[i]=2
        continue
    for j in range(i,M,i):
        cnt[j]+=1
ans=0
for i in A:
    if cnt[i]==1:
        ans+=1
print(ans)
def main():
  n, *A = map(int, open(0).read().split())
  A.sort()
  m = A[-1]
  lst = [0] * (m + 1)
  prep = 0
  for i in A:
    if i == prep:
      lst[i] = 1
      continue
    lst[2 * i::i] = [1] * len(lst[2 * i::i])
    prep = i
  res = 0
  for i in A:
    if lst[i] == 0:
      res += 1
  print(res)

if __name__ == '__main__':
  main()
n = int(input())
A = list(map(int, input().split()))
A.sort()
A_max = A[-1]
dp = [1] * (A_max + 1)
ans = 0

for i in range(len(A)-1):
    p = A[i]
    if dp[A[i]] == 1:
        for j in range(A_max // p + 1):
            dp[j*p] = 0
        if A[i] != A[i+1]:
            ans += 1
            
if dp[A_max] == 1:
    ans += 1

print(ans)
import sys
from collections import Counter

N = int(input())
A = list(map(int, input().split()))

Amx = max(A)
A.sort()
As = set(A)
# DP
ca = Counter(A)
ans = 0
dp = [True] * (Amx + 1)
for a in A:
    if ca[a] <= 1 and dp[a]:
        ans += 1
    k = 1
    while k * a <= Amx:
        dp[k * a] = False
        k += 1
print(ans)
n = int(input())
a = list(map(int,input().split()))
a.sort()
ok = [1]*(10**6+1)
ans = 0
for i in range(n):
    if ok[a[i]]:
        if i < n-1:
            if a[i+1] != a[i]:
                ans += 1
        else:
            ans += 1
        for j in range(1,10**6//a[i]+1):
            ok[a[i]*j] = 0
print(ans)
import numpy as np
from numba import njit
  
# @njit('(i4[::1],)', cache=True)
@njit
def solve(A):
    count = np.zeros(10**6 + 10, np.int32)
    for x in A:
        if count[x] > 1:
            continue
        count[::x] += 1
    ret = 0
    for x in A:
        ret += count[x] == 1
    return ret

N = int(input())
A = np.array(list(map(int,input().split())), np.int32)
 
print(solve(A))
from collections import Counter
n = int(input())
ns = list(map(int, input().split()))
c = Counter(ns)
ans = 0

l = [True] * (max(ns)+1)
for i in sorted(set(ns)):
    if l[i]:
        j = i*2
        while j < len(l):
            l[j] = False
            j += i

a = set([key for key, value in c.items() if value == 1])
for i in a:
    if l[i]:
        ans += 1
print(ans)
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**6)

N=int(input().rstrip())
a=[int(i) for i in input().split()]
l=max(a)+1
cnt=[0]*l
for i in a:
    for j in range(i,l,i):cnt[j]+=1

ans=0
for i in a:
    if cnt[i]==1:
        ans+=1
print(ans)
import collections

n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
c = collections.Counter(a)
data = sorted(list(set(a)))
max_ = max(a)+1
prime_bool = [True]*max_
prime_bool[0] = False

for i in range(len(data)):
  p = data[i]
  if prime_bool[p]:
    #print(p)
    k = 2
    while k*p < max_:
      prime_bool[k*p] = False
      k += 1

count = 0
for i in range(len(prime_bool)):
  if prime_bool[i]:
    if c[i] == 1:
      count += 1
print(count)
#print(prime_bool)
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int,input().split()))

l = [0]*1000001

A.sort()

for a in A:
    if l[a] == 0:
        l[a] = 1
        tmp = 2
        while tmp*a <= 1000000:
            l[tmp*a] = 2
            tmp+=1
    elif l[a] == 1:
        l[a] = 2

ans = 0
for a in A:
    if l[a] != 2:
        ans += 1

print(ans)
from collections import Counter
import bisect
N = int(input())
A = list(map(int,input().split()))
cnt = Counter(A)
A.sort()
ans = 0
MX = 10**6
P = [0] * (MX+1)
for a in A:
    if P[a]==0:
        for i in range(MX+1):
            x = a*i
            if x > MX:
                break
            P[x] = 1
        if cnt[a]==1:
            ans+=1
print (ans)
import collections
N = int(input()) 
A = sorted(list(map(int, input().split())))
unique_count = collections.Counter(A)
A_count1 = []
A_unique = list(set(A))
baisu = [0]*(10**6+1)

for k,v in unique_count.items():
    if v == 1: A_count1.append(k)

for a_unique in A_unique:
    for i in range(a_unique*2,10**6+1,a_unique):
        baisu[i] = 1

ans = 0

for a_count1 in A_count1:
    if baisu[a_count1]==0: ans += 1

print(ans)
n = int(input())
a = list(map(int, input().split()))
ln = max(a) + 1
l = [0]*ln
ans = 0

for i in a:
    for j in range(i, ln, i):
        l[j] += 1

for i in a:
    if l[i] == 1:
        ans += 1

print(ans)
n = int(input())
a = list(map(int, input().split()))
a.sort()
MAX = int(1e6) + 10
sieve = [0] * int(MAX)
for i in a:
    sieve[i] += 1
ans = 0
for idx, val in enumerate(sieve):
    if val == 0:
        continue
    elif val > 1:
        sieve[idx] = 0
    else:
        ans += 1
    for i in range(idx * 2, MAX, idx):
        sieve[i] = 0
print(ans)
from collections import Counter
max_=10**6+1
ans=0

n=int(input())
data=list(map(int,input().split()))

b=[True]*(max_+1)
data.sort()
c=Counter(data)
#print(c)

for d in data:
    if b[d]:
        for j in range(d,max_,d):
            b[j]=False
        if c[d]==1:#複数存在考慮
            ans+=1
print(ans)
from collections import defaultdict
n = int(input())
a = list(map(int,input().split()))
a = sorted(list(a))
ma = max(a)

div = defaultdict(bool)
count = 0
for i in range(n):
    b = a[i]
    if div[b]:
        count += 1
    else:
        for j in range(1,ma//b+1):
            div[j*b] = True
        if(i+1<n and a[i] == a[i+1]):
            count += 1

print(n-count)
n = int(input())
A = [*map(int, input().split())]
mx = max(A)
c = [0]*(mx+1)
for a in A:
    if c[a]: c[a] = 2; continue
    for i in range(a, mx+1, a): c[i] += 1
ans = 0
for a in A:
    if c[a] == 1: ans += 1
print(ans)
#!python3.8
# -*- coding: utf-8 -*-
# abc170/abc170_d
from collections import Counter

def main():
    N = input()
    A = sorted(map(int, input().split(' ')))
    B = Counter(A)
    for a in A:
        if B[a] == 0:
            continue
        if B[a] > 1:
            B[a] = 0
        for i in range(2, A[-1] // a + 1):
            B[a * i] = 0
    print(sum(B.values()))
    return

main()
n = int(input())
A = list(map(int, input().split()))
A.sort()

ndiv_sum = 0
max_num = A[-1]
no_div = [True] * (max_num+1)
for i in range(len(A)-1):
    if no_div[A[i]]:
        for j in range(A[i], max_num+1, A[i]):
            no_div[j] = False
        if A[i]!=A[i+1]:
            ndiv_sum += 1
if no_div[A[-1]]:
    ndiv_sum += 1
print(ndiv_sum)
N = int(input())
A = list(map(int, input().split()))
M = 1000005
cnt = [0]*M
for a in A:
    if cnt[a]!=0:
        cnt[a]+=1
        continue
        
    for i in range(a, M, a):
        cnt[i]+=1
        
ans = 0
for a in  A:
    if cnt[a] == 1:
        ans+=1
print(ans)
n = int(input())
a = list(map(int, input().split()))

xs = [0] * (max(a) + 1)

for v in a:
    if xs[v] == 0:
        for j in range(v, len(xs), v):
            xs[j] += 1
    else:
        xs[v] += 1
print(len(list(filter(lambda v: xs[v] == 1, a))))
N = int(input())
As = list(sorted(list(map(int, input().split()))))

max_num = max(As)
tfs = [0 for _ in range(max_num+1)]

for A in As:
    if tfs[A] != 0:
        tfs[A] = 2
        continue
    for j in range(A, max_num+1, A):
        tfs[j]+=1

result = 0
for A in As:
    if tfs[A] == 1:
        result+=1
print(result)
n=int(input())
ar=list(map(int,input().split()))
ar.sort()
div=[0 for i in range(ar[-1]+1)]
for i in ar:
    if div[i]<=1:
        for j in range(i,ar[-1]+1,i):
            div[j]+=1
ans=0
for i in ar:
    if div[i]==1:
        ans+=1
print(ans)
def main1():
    N=int(input())
    A=list(map(int,input().split()))
    A.sort()
    ans=[0]*(10**6+1)
    if N ==1 :
        print(1)
        return 
    for i in  range(len(A)):
        ans[A[i]]+=1
        if ans[A[i]]==1:
            for j in range(A[i]*2,10**6+1,A[i]):
                ans[j]=2
    print(ans.count(1))
main1()
import sys
input = lambda: sys.stdin.readline().rstrip()

N = int(input())
div = [0] * 1000005

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

for num in A:
    if div[num] == 0:
        for i in range(num, 1000005, num):
            div[i] += 1
    else:
        div[num] += 1
ans = 0
for num in A:
    if div[num] == 1:
        ans += 1

print(ans)
n = int(input())
a = sorted(list(map(int, input().split())))
MA = (max(a) + 1)
ans = [0] * MA

for i in range(n):
    for j in range(a[i],MA,a[i]):
        ans[j] += 1
print(sum(ans[i]==1 for i in a))
n = int(input())
a = sorted(list(map(int,input().split())))
am = a[-1]+1
b = [0]*am
for i in a:
    b[i]+=1
    if b[i]==1:
        for j in range(i*2,am,i):
            b[j]=2
print(b.count(1))
# D - Not Divisible

N = int(input())
A = list(int(a) for a in input().split())
A.sort()

M = max(A)
is_D = [0] * (M+1)
for i, a in enumerate(A):
    if is_D[a]:
        is_D[a] = 2
        continue
    for j in range(a, M+1, a):
        is_D[j] += 1

ans = 0
for a in A:
    if is_D[a] == 1:
        ans += 1
print(ans)
N=int(input())
A=list(map(int, input().split()))
A=sorted(A)
D=[1]*(A[-1]+1)
for i in A:
  if D[i]==1:
    for j in range(A[-1]//i):
      D[i*(j+1)]=0
    D[i]=1
dic={}
for i in A:
  if i not in dic:
    dic[i]=1
  else:
    D[i]=0
ans=0
for i in A:
  if D[i]==1:
    ans+=1
print(ans)
from collections import Counter

n = int(input())
A = list(map(int, input().split()))
A.sort()
max_a = A[-1] + 1
count_a = Counter(A)
dp = [True for i in range(max_a)]
ans = 0

for a in A:
    if dp[a] and count_a[a] == 1:
        ans += 1

    for j in range(a*2, max_a, a):
        dp[j] = False

print(ans)
M=10**6+1
_,*l=map(int,open(0).read().split())
a=[0]*M
for i in l:
  if a[i]<1:
    for j in range(i*2,M,i): a[j]=2
  a[i]+=1
print(a.count(1))
n = int(input())
a = list(map(int,input().split()))

cnt = [0] * 1000005
for x in a:
    if cnt[x] != 0: 
        cnt[x] = 2
    else: 
        for i in range(x,1000005,x):
            cnt[i] += 1

ans = 0
for x in a:
    if cnt[x] == 1:
        ans += 1

print(ans)
N = int(input())
*A, = map(int, input().split())
m = max(A)
cnt = [0] * (m + 1)
for elem in A:
    cnt[elem] += 1
unique = []
for i in range(m + 1):
    if cnt[i] == 1:
        unique.append(i)
cnt = [0] * (m + 1)
A = list(set(A))
for elem in A:
    for mul in range(elem * 2, m + 1, elem):
        cnt[mul] = 1
ans = 0

for elem in unique:
    if cnt[elem] == 0:
        ans += 1
print(ans)
N = int(input())
A = list(map(int, input().split()))
B = set()
C = set()
for a in A:
    if a in B:
        C.add(a)
    else:
        B.add(a)
M = max(B)
bool = [1]*(M+1)
for c in C:
    bool[c] = 0
for b in B:
    for i in range(b*2, M+1, b):
        bool[i] = 0
ans = 0
for a in A:
    if bool[a] == 1:
        ans += 1
print(ans)
from collections import Counter
n = int(input())
lista = list(map(int, input().split()))

count = Counter(lista)
lista.sort()

M = 1000001
P = [0] * (M+1)
ans = 0

for i in lista:
    if P[i] == 0:
        for j in range(M+1):
            x = i * j
            if x > M:
                break
            P[x] = 1
        if count[i] == 1:
            ans += 1

print(ans)
n = int(input())
a = list(map(int,input().split()))

a.sort()

max_a = a[-1]
is_available = [True] * (max_a + 1)

ans = 0

for i, x in enumerate(a[:-1]):
    if is_available[x]:
        if not a[i+1] == x:
            ans += 1
        for b in range(x, max_a + 1, x):
            is_available[b] = False

if is_available[a[-1]]:
    ans += 1

print(ans)
n = int(input())
A = sorted(map(int, input().split()))
used = set()

U = A[-1]+1
is_prime = [1]*U
cnt = [0]*U
depri = 0
for a in A:
    cnt[a] += 1
    if cnt[a] == 2 and is_prime[a]:
        depri += 1
    if is_prime[a]:
        used.add(a)
        for q in range(2*a, U, a):
            is_prime[q] = 0
print(len(used)-depri)
from collections import Counter
def main():
    n=int(input())
    A=list(map(int,input().split()))
    A.sort()
    C=Counter(A)
    m=A[-1]
    Flag=[True]*(m+1)
    ans=0
    for i,a in enumerate(A):
        if Flag[a]:
            ans+=int(C[a]==1)
            for i in range(a*2,m+1,a):
                Flag[i]=False
    print(ans)
    
if __name__=='__main__':
    main()
from sys import stdin

def main():
    from collections import defaultdict
    input = stdin.readline

    n = int(input())
    a = sorted(list(map(int, input().split())))
    p = defaultdict(int)
    for x in a:
        p[x] += 1
    q = a[-1] + 1
    f = [True] * (q)
    for k, v in p.items():
        if v > 1:
            f[k] = False
        for i in range(k + k, q, k):
            f[i] = False
    print(sum(1 for x in a if f[x]))
main()
import sys
import numpy as np
from numba import njit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

#@njit
def slove(A):
  count = np.zeros(10**6 + 10, np.int32)
  for x in A:
    if count[x] > 1:
      continue
    count[::x] += 1
  ret = 0
  for x in A:
    ret += count[x] == 1
  return ret

A = np.array(read().split(), np.int32)[1:]

print(slove(A))
n = int(input())
a = list(map(int,input().split()))
cnt = [0] * (10**6 + 1)

for i in a:
    cnt[i] += 1
    
unique = []

for i in range(10**6 + 1):
    if cnt[i] == 1:
        unique.append(i)

cnt = [0] * (10**6 + 1)

a = list(set(a))

for i in a:
    for j in range(i*2, 10**6 + 1, i):
        cnt[j] = 1
    
ans = 0

for i in unique:
    if cnt[i] == 0:
        ans += 1
        
print(ans)
from collections import Counter

N=int(input())
A=Counter(list(map(int,input().split())))
nmax=10**6
iscop=[True]*(nmax+1)

for k in A.keys():
    if iscop[k]==False:
        continue

    for j in range(2,nmax//k+1):
        iscop[k*j]=False
ans=0
for k,v in A.items():
    if v<2 and iscop[k]:
        ans+=1

print(ans)
from collections import Counter


n = int(input())
A = list(map(int, input().split()))

ok = [False] * (10**6 + 1)
for a in A:
    ok[a] = True

for i in range(10**6 + 1):
    if ok[i]:
        j = 2
        while i * j <= 10**6:
            ok[i * j] = False
            j += 1

for a, cnt in Counter(A).items():
    if cnt >= 2:
        ok[a] = False

print(sum(ok))
n = int(input())
a = list(map(int, input().split()))
a.sort()
c = [0]*(1000001)
for i in a:
    c[i] += 1
b = list(set(a))
ans = []
b.sort()

num = [True]*(1000001)

for i in range(len(b)):
    now = b[i]
    if num[now]:
        ans.append(now)
        for j in range(now, 1000001, now):
            num[j] = False


count = 0
for i in ans:
    if c[i] == 1:
        count += 1

print(count)
MAXA = 10**6+1
N = int(input())
A = list(map(int,input().split()))
A.sort()
A.append(0)
hurui = [0]*(MAXA)
ans = 0
for i in range(N):
    a = A[i]
    if hurui[a] == 0:
        if A[i] != A[i+1]:
            ans += 1
    else:
        continue
    for j in range(a,MAXA,a):
        hurui[j] = 1
print(ans)
n = int(input())
A = list(map(int, input().split()))
A=sorted(A)
up=max(A)
table=[0]*(up+1)
for i in range(n):
    table[A[i]]+=1
aset=set(A)

for i in range(len(aset)):
    if table[A[i]]>0:
        j=2
        while A[i]*j<up+1:
            if table[A[i]*j]>0:
                table[A[i]*j]=-1
            j+=1

cnt=0
for x in table:
    if x==1:
        cnt+=1
print(cnt)