peterverebics/CodeNet_Python_118 huggingface dataset:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a.sort()
check = [True] * (a[-1] + 1)
cnt = Counter(a)

for i in range(n):
    if check[a[i]] == False:continue
    for j in range(a[i], a[-1] + 1, a[i]):
        if j == a[i]:continue
        check[j] = False

ans = 0
for i in range(n):
    if check[a[i]] and cnt[a[i]] == 1:ans += 1

print(ans)
from collections import Counter

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

a.sort()
cnt = 0
nmax = a[-1]
table = [True] * (nmax+1)
c = Counter(a)

duplicate = []
for i in c.keys():
    if c[i] > 1:
        duplicate.append(i)
for i in a:
    if not table[i]:
        continue
    if not i in duplicate:
        cnt += 1
    for j in range(i*2, nmax+1, i):
        table[j] = False
print(cnt)
n = int(input())
l = [int(x) for x in input().split()]
D = set() #Duplication
S = set() #all
for x in l:
    if x in S:
        D.add(x)
    else:
        S.add(x)

M = max(S)
limit = M+1
mp = [0]*(limit)

cnt = 0
S = sorted(S)
for x in S:
    for y in range(x,limit,x):
        mp[y] += 1
    if(x in D):
        continue
    if(mp[x]==1):
        cnt += 1
        
print(cnt)
N = int(input())
A = sorted(list(map(int, input().split())))
Amax = max(A)

ans = [False] * (Amax + 1)
for x in A:
    for j in range(x, Amax + 1, x):
        ans[j] += 1

print(sum(ans[i] == 1 for i in A))
import collections,sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N = I()
A = sorted(LI())
counter_A = collections.Counter(A)
sequence = [0]*(10**6+1)
ans = 0
for k,v in counter_A.items():
    if sequence[k]==1:
        continue
    if v==1:
        ans += 1
    for i in range(k,10**6+1,k):
        sequence[i] = 1
print(ans)
n = int(input())
a = list(map(int,input().split()))
a.sort()

n_max = 10**6+1

ans = 0
flag = [True] * (n_max)
for i in range(n-1):
    if(not flag[a[i]]):
        continue

    if(a[i]!=a[i+1]):
        ans += 1
    for j in range(a[i],n_max,a[i]):
        flag[j] = False

ans += flag[a[-1]]*1
print(ans)
n = int(input())
a = list(map(int, input().split()))

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

for elem in a:
    cnt[elem] += 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 elem in a:
    for m in range(elem * 2, (10 ** 6) + 1, elem):
        cnt[m] = 1

ans = 0

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

print(ans)
N = int(input())
As = list(map(int, input().split()))

max_per = max(As)
ansList = [0 for _ in range(max_per + 10)]

for A in As:
    checkList = [i for i in range(A, max_per+1, A)]
    #print(checkList,As)

    for check in checkList:
        ansList[check] += 1

ans = 0

for A in As:
    if(ansList[A] == 1):
        ans += 1

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

b = [True for i in range(a[-1]+1)]

ans = 0

for i, j in enumerate(a):
    if b[j]:
        t = 1
        while j*t < len(b):
            b[j*t] = False
            t += 1
        
        if i == n-1:
            ans += 1
        elif j != a[i+1]:
            ans += 1
        
print(ans)
def main():
    n = int(input())
    A = [int(e) for e in input().split()]

    ma = max(A)
    N = [0] * (10 ** 6 + 1)
    for a in A:
        for i in range(a, ma + 1, a):
            N[i] += 1

    ans = 0
    for a in A:
        if N[a] == 1:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()
from collections import Counter
def main():
    M = 10 ** 6
    _ = int(input())
    A = list(map(int,input().split()))
    erato = [True] * (M+10)
    m = sorted(Counter(A).items())
    ans = 0
    for t in m:
        if t[1] == 1 and erato[t[0]]:
            ans += 1
        for i in range(t[0],M+1,t[0]):
            erato[i] = False
            
    print(ans)


if __name__ == '__main__':
    main()
import collections
import heapq
import math
import random
import sys
input = sys.stdin.readline
sys.setrecursionlimit(500005)
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
rs = lambda: input().rstrip()

n = ri()
a = rl()
N = 1000000
f = [0] * (N + 10)
for v in a:
    f[v] += 1
for i in range(N, 0, -1):
    if f[i] == 0:
        continue
    j = i * 2
    while j <= N:
        f[j] += f[i]
        j += i
cnt = sum(f[i] == 1 for i in a)
print(cnt)
# D

N = int(input())

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

for a in map(int, input().split()):
  d[a] += 1

ans = 0

for i in range(1,10**6+1):
  if d[i] == 1:
    ans += 1

  if d[i] > 0:
    # d[i]の倍数は含めない
    for j in range(i*2,10**6+1,i):
      d[j] = 0

print(ans)
import numpy as np

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

vals, cnts = np.unique(A, return_counts=True)

if len(vals) == 1:
    print(0 if cnts[0] > 1 else 1)
elif vals[0] == 1:
    print(0 if cnts[0] > 1 else 1)
else:
    sat = np.ones(vals.max() + 1, dtype=int)
    for x in vals:
        sat[2 * x::x] = 0
    ans = ((sat[vals] == 1) & (cnts == 1)).sum().item()
    print(ans)

# 5
# 2 2 2 3 3
# 5
# 2 2 2 4 4
# 5
# 1 1 1 1 2
N = int(input())
l = [0]*(10**6+1)
for a in map(int,input().split()) :
    l[a] += 1
ans = 0

for i in range(1, 10**6 + 1) :
    if l[i] == 1 :
        ans += 1
    if l[i] > 0 :
        for j in range(i , 10**6 + 1, i) :
            l[j] = 0

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

A.sort()
A.append(-1)

x = A[0]
if x != 1:
    flag = True
    for a in A:
        if a % x != 0:
            flag = False
    if flag:
        print(0)
        exit()

used = [False] * A[-2]
ans = 0
for idx, a in enumerate(A[:-1]):
    if used[a - 1]:
        continue
    if a != A[idx + 1]:
        ans += 1
    for j in range(a, len(used) + 1, a):
        used[j - 1] = True
print(ans)
N = int(input())
A = list(map(int, input().split()))

MAX = 10 ** 6

A.sort()
s = set()
ans = N
for i in range(N):
    a = A[i]
    if a in s:
        ans -= 1
        continue
    if i < N - 1 and A[i + 1] == a:
        ans -= 1
    n = MAX // a
    for i in range(1, n + 1):
        s.add(a * i)
print(ans)
from collections import Counter

N, *A = map(int, open(0).read().split())

m = max(A) + 1
ok = [True] * m
ctr = Counter(A)
ans = 0
for a in sorted(A):
    if ok[a] and ctr[a] == 1:
        ans += 1
        
    for j in range(2 * a, m, a):
        ok[j] = False
            
print(ans)
N = int(input())
A = sorted(list(map(int,input().split())))
lim = max(A)
B = [0] * (lim+1)
for i in range(N):
    B[A[i]] += 1
ans = N
for i in range(1,lim+1):
    if B[i] == 0:
        continue
    if B[i] >= 2:
        ans -= B[i]
        B[i] = 0
    for j in range(i*2,lim+1,i):
        ans -= B[j]
        B[j] = 0

print(ans)
# MAX = int(1e6)+2


n = int(input())
lis = list(map(int,input().split()))
lis.sort()
MAX = lis[-1]
lis2 = [0]*(MAX+1)
# lis.sort()
# m = max(lis)
ans = 0

for num in lis:
    for i in range(num, MAX+1, num):
            lis2[i] += 1

for j in set(lis):
    if lis2[j] == 1:
        ans += 1
print(ans)
n = int(input())
a = list(map(int, input().split()))
cnt = [0] * (10 ** 6 + 1)
a.sort()
ans = 0


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

a = set(a)

for k in a:
    for l in range(k * 2, (10 ** 6 + 1), k):
        cnt[l] += 1

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


print(ans)
from collections import Counter

N = int(input())
a = sorted(list(map(int, input().split())))

M = 10**6

table = [1] * (M + 1)

B = Counter(a)
Key = list(B.keys())

count = 0
for x in Key:
    if B[x] == 1 and table[x] == 1:
        count += 1

    for i in range(M):
        if i * x > M:
            break
        else:
            table[i * x] = 0

print(count)
def resolve():
	N = int(input())
	A = list(map(int, input().split()))
	a_max = max(A)+1
	B = {}
	for i in range(N):
		a = A[i]
		if a not in B.keys():
			for j in range(a, a_max, a):
				B[j] = False
			B[a] = True
		else:
			B[a] = False
	Y = list(B.values()).count(True)
	print(Y)
resolve()
n=int(input())
l=list(map(int,input().split()))
l.sort()
p=[1]*(l[-1]+1)
ans=0
for i in range(n):
  a=l[i]
  if p[a]==1:
    b=a
    while a<=l[-1]:
      p[a]=0
      a+=b
    if i<n-1:
      if l[i]==l[i+1]:
        pass
      else:
        ans+=1
    else:
      ans+=1
print(ans)
n=int(input())
alist=list(map(int,input().split()))


alist.sort()

hurui=[0]*(alist[-1]+1)

for i in range(n):
    for j in range(1,alist[-1]//alist[i]+1):
        hurui[alist[i]*j]+=1
ans=0
for i in range(n):
    if hurui[alist[i]]==1:
        ans+=1
print(ans)
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

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

n = ni()
a = na()

f = [0] * 1000005
for v in a:
    f[v] += 1
for i in range(1000000, 0, -1):
    if f[i] == 0:
        continue
    j = i*2
    while j <= 1000000:
        f[j] += f[i]
        j += i
ct = 0
for v in a:
    if f[v] == 1:
        ct += 1
print(ct)
n = int(input())
*A, = map(int, input().split())

C = {a:0 for a in A}

for a in A:
    C[a] += 1

maxA = max(A)

D = {a:0 for a in A}

for a in A:
    t = 2
    while a*t <= maxA:
        D[a*t] = 1
        t = t+1

counter = 0
for a in A:
    if C[a] == 1 and D[a] == 0:
        counter += 1
        
print(counter)
# D

N = int(input())

d = [0] * (10**6 + 1) 
A = list(map(int, input().split()))

for a in A:
  d[a] += 1

ans = 0
maxa = max(A) + 1
for i in range(1,maxa):
  if d[i] == 1:
    ans += 1

  if d[i] > 0:
    # d[i]の倍数は含めない
    for j in range(i*2,maxa,i):
      d[j] = 0

print(ans)
N = int(input())
A = [int(a) for a in input().split()]

M = 10**6+1
L = [0]*M

for a in A:
    if L[a] >= 1:
        L[a] = 2
        continue
    L[a] = 1
    i = 2
    while a*i < M:
        L[a*i] = 2
        i += 1

ans = 0
for a in A:
    if L[a] == 1:
        ans += 1
print(ans)
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a.sort()
dp = [0] * a[-1]
c = Counter(a)
for i in a:
    for j in range(i, a[-1]+1, i):
        dp[j-1] += 1
ans = 0
for i in a:
    if dp[i-1] == 1 and c[i]:
        ans += 1
print(ans)
N = int(input())
A = list(map(int,input().split()))

ma = max(A)
Er = [0 for _ in range(ma + 5)]

for i in range(N):
    temp = A[i]
    if Er[temp] != 2:
        a = 0
        while(1):
            a += 1
            tt = a * temp
            if tt >= ma + 5:
                break
            Er[tt] += 1
        
ans = 0
for i in range(N):
    temp = A[i]
    if Er[temp] == 1:  ans += 1
        
print(ans)
n=int(input())
a=list(sorted(map(int,input().split())))
d=[0 for i in range(a[-1]+1)]
c=0
for i in range(len(a)):
  if d[a[i]]:
    continue
  if i==len(a)-1 or a[i]!=a[i+1]:
    c+=1
  for j in range(a[i],a[-1]+1,a[i]):
    d[j]=1
print(c)
N = int(input())
A = list(map(int, input().split()))
A.sort()
exist_flags = [0] * (10 ** 6)
for a in A:
    if exist_flags[a - 1] > 0:
        exist_flags[a - 1] += 1
    else:
        # for i in range(a, 25, a):
        for i in range(a, 10 ** 6 + 1, a):
            exist_flags[i - 1] += 1


ans = 0
for a in A:
    if exist_flags[a - 1] == 1:
        ans += 1
print(ans)
n = int(input())
a = list(map(int, input().split()))

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

for elem in a:
    cnt[elem] += 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 elem in a:
    for m in range(elem * 2, (10 ** 6) + 1, elem):
        cnt[m] = 1

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

print(ans)
#D-Not Divisible
#pdf見た
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
maxi = a[-1]
boo = [True]*(maxi+1)

for i in range(n):
    k = a[i]
    if not boo[k]:
        continue
    if i != n-1 and k == a[i+1]:
        boo[k] = False
    for j in range(2,maxi//k+1):
        boo[k*j] = False
    
count = 0
for k in a:
    if boo[k] == True:
        count += 1

print(count)
n=int(input())
a=list(map(int,input().split()))
a.sort()
k=max(a)

num_list=set()
prime_list=set()

from collections import Counter
dic=Counter(a)
a=set(a)

for i in dic:
  if dic[i]>=2:
    dic[i]=0
  if i not in num_list:
    for j in range(i*2,k+1,i):
      if j in a:
        dic[j]=0
        num_list.add(j)

print(sum(dic.values()))
n = int(input())
A = list(map(int,input().split()))
A.sort()
B = [0]*(A[-1]+1)
ans = 0
for i,a in enumerate(A):
    if B[a]:
        continue
    else:
        if i+1 == n or A[i+1] != a:
            ans += 1
        x = a
        while x <= A[-1]:
            B[x] = 1
            x += a
print(ans)
from collections import Counter


def main():
    N = int(input())
    A = list(map(int, input().split()))
    C = Counter(A)
    S = list(set(A))
    ND = [True]*(10**6 + 1)
    for e in S:
        m = e*2
        while m <= 10**6:
            ND[m] = False
            m += e
    ans = 0
    for a in A:
        if C[a] == 1 and ND[a]:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()
N=int(input())
A=list(map(int,input().split()))

M=max(A)
check=[0]*(M+1)
#A.sort()
for i in range(N):
    a=A[i]
    if check[a]>1:
        continue
    while a<=M:
        check[a]+=1
        a+=A[i]
ans=0
for i in range(N):
    if check[A[i]]==1:
        ans+=1

print(ans)
import copy

def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    A_max = A[N-1]

    div_count = [0] * (A_max + 1)

    for a in A:
        for n in range(a, A_max+1, a):
            div_count[n] += 1

    exists = [False] * (A_max + 1)
    for a in A:
        exists[a] = True

    result = 0
    for i, d in enumerate(div_count):
        if d == 1 and exists[i]:
            result += 1

    print(result)

main()
from collections import Counter, defaultdict

N = int(input())
A = [int(x) for x in input().split()]
A.sort()

C = Counter(A)
D = defaultdict(bool)
for key in C.keys():
    D[key] = True

B = [True] * N
ans = 0
for i in range(N):
    if not D[A[i]]: continue
    if C[A[i]] > 1:
        D[A[i]] = False

    for a in range(2 * A[i], A[-1] + 1, A[i]):
        D[a] = False

ans = 0
for key in D:
    if D[key]:
        ans += 1
print(ans)
N=int(input())
A=list(map(int,input().split()))
A.sort()
dic={}
for i in range(N):
    if A[i] not in dic:
        dic[A[i]]=0
    dic[A[i]]+=1
ban=set([])
res=0
for i in range(N):
    a=A[i]
    if a not in ban:
        if dic[A[i]]==1:
            res+=1
        for j in range(1,10**6//a+1):
            ban.add(a*j)

print(res)
from collections import Counter

def undivisible(A):
    m = max(A)
    dp = [True] * (m+1)
    A.sort()
    for a in A:
        if dp[a]:
            k = a * 2
            while k <= m:
                dp[k] = False
                k += a
    cnt = Counter(A)
    ans = 0
    for a in A:
        if dp[a] and cnt[a] == 1:
            ans += 1
    return ans

n = int(input())
A = list(map(int, input().split()))
print(undivisible(A))
n = int(input())
a = list(map(int, input().split()))
a.sort()
m = a[-1]

c = [0] * (m + 1)
for i in range(n):
    for j in range(a[i], m + 1, a[i]):
        c[j] += 1

ans = 0
for e in list(set(a)):
    if c[e] == 1:
        ans += 1

print(ans)
N=int(input())
lineup=sorted([int(x) for x in input().split()])
duplicate={}
for i in lineup:
	if i in duplicate:
		duplicate[i]+=1
	else:
		duplicate[i]=1
b=max(lineup)+1
sieve=[1]*(b)
counter=0
for i in range(N):
	for j in range(lineup[i]*2,b,lineup[i]):
		sieve[j]=0
	if duplicate[lineup[i]]==1 and sieve[lineup[i]]==1:
		counter+=1
print(counter)
n = int(input())
a = list(map(int, input().split()))
a.sort()
a.append(0)
b = {}
c = 0
for i in range(n):
    if a[i] not in b:
        for j in range(1, 10**6//a[i]+1):
            b[a[i]*j] = 1
        if a[i] != a[i+1]:
            c += 1
print(c)
N = int(input())
A = list(map(int, input().split()))
# M = max(A)+1
M = 10**6+1
cnt = [0]*M
ans = 0
for a in A:
    if cnt[a] != 0:
        cnt[a] = 2
    else:
        for i in range(a, M, a):
            cnt[i] += 1
for a in A:
    if cnt[a] == 1:
        ans += 1
print(ans)
N = int(input())
A = list(map(int, input().split()))
m = max(A)+10
dp = [0] * m

for x in A:
    dp[x] += 1

ans = 0
for i in range(1, m):
    if dp[i]:
        if dp[i] == 1:
            ans += 1
        for j in range(i, m, i):
            dp[j] = 0
print(ans)
N=int(input())
A=list(map(int,input().split()))
dp=[False]*(10**6+1)
A.sort()
ans=0
before_ = -1
for i in A:
  if dp[i]==False:
    for j in range(2*i,10**6+1,i):
      dp[j]=True
  if before_ == i:
      dp[i]=True
  before_=i

for i in A:
  if dp[i]==False:
    ans+=1
print(ans)
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
ma=max(a)
a.sort()
era=[1]*(ma+1)
#0と1はふるいにかけられている。
cn=Counter(a)

count=0
for i in range(n):
  if era[a[i]]==0:continue
  else:
    era[a[i]]=0
    if cn[a[i]]==1:
      count+=1
    for j in range(2*a[i],ma+1,a[i]):
      era[j]=0
print(count)
n = int(input())
a_list = list(map(int, input().split()))
a_list.sort()
ans_list = [0] * (a_list[n - 1] + 1)
ans = 0

for a in a_list:
    if ans_list[a] >= 1:
        ans_list[a] += 1
        continue
    for j in range(2 * a, a_list[n - 1] + 1, a):
        ans_list[j] += 1
    ans_list[a] = 1

for a in a_list:
    if ans_list[a] == 1:
        ans += 1
print(ans)
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 14 21:14:26 2020

@author: NEC-PCuser
"""

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

a = [0] * (10 ** 6)

for i in A:
    first_flg = True
    for j in range(i, 10 ** 6 + 1, i):
        if first_flg == True and a[j - 1] != 0:
            a[j - 1] += 1
            break
        a[j - 1] += 1
        first_flg = False


count = 0
for i in A:
    if a[i - 1] == 1:
        count+=1

print(count)
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
a.sort()
b = Counter(a)
ma = a[-1]

check = [True] * (ma+1)

ans = 0
for i in range(n):
    if check[a[i]]:
        if b[a[i]] == 1:
            ans += 1
            
        for j in range(a[i],ma+1,a[i]):
            check[j] = False
            
print(ans)
from collections import Counter

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

m=a[-1]+1
dp=[1]*m
c=Counter(a)
ans=0
for i in a:
    if dp[i] and c[i]==1:
        ans+=1

    for j in range(2*i, m, i):
        dp[j]=0

print(ans)
#print(c)
import math

N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
maxA = A[len(A)-1]
valid = [True] * (maxA+1)

for i in range(len(A)):
    if valid[A[i]] == False:
        continue
    if i != 0 and A[i-1] == A[i]:
        valid[A[i]] = False
    else:
        for j in range(A[i]*2, maxA+1, A[i]):
            valid[j] = False

count = 0
for i in range(len(A)):
    if valid[A[i]] == True:
        count += 1
print(count)
n = int(input())
A = list(map(int, input().split()))

MAX_N = max(A)+ 1
cnt = [0] * MAX_N
for a in A:
    for i in range(a, MAX_N, a):
        if cnt[i] <= 2: 
            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()))

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

for elem in a:
    cnt[elem] += 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 elem in a:
    for m in range(elem * 2, (10 ** 6) + 1, elem):
        cnt[m] = 1

ans = 0

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

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

m_a = max(A)+1
dp = [0]*m_a

for i in A:
    dp[i] += 1
    if dp[i]==1:
        for j in range(i*2, m_a, i):
            dp[j] += 2
    # print(dp)
print(dp.count(1))
N = int(input())
A = list(map(int, input().split()))
A.sort()
M = A[-1]
b = [True] * (M + 1)

count = 0
for i, a in enumerate(A):
  if not b[a]:
    continue
  for j in range(a, M+1, a):
    b[j] = False
  if i < N-1 and A[i+1] == a:
    continue
  count += 1

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

m=1000000
c=[0]*(m+1)

for i in a:c[i]+=1

for i in range(1,m+1):
	if c[i] == 0:continue
	for j in range(i*2,m+1,i):
		c[j]+=1
ans=0
for i in a:
 if c[i]==1:ans+=1
print(ans)
N = int(input())
AList = list(map(int, input().split()))

sortList = sorted(AList)
Amax = max(sortList)
dp = [0] * (Amax+1)

for n in sortList:
  dp[n] += 1
  if dp[n] == 1:
    for j in range(n*2, Amax+1, n):
      dp[j] += 2
print(dp.count(1))
import collections

n = int(input())
a = list(map(int,input().split()))
cnt = collections.Counter(a)
#print(cnt)
a.sort()
dp = [1]*(max(a)+1)

sum = 0
for i in range(n):
    for j in range(a[i]*2,len(dp),a[i]):
            dp[j] = 0
    if dp[a[i]] == 1 and cnt[a[i]]==1:
        sum += 1

print(sum)
n = int(input())
a = list(map(int,input().split()))
a.sort()
ma = a[-1]

dp = [0]*(ma+1)

for i in range(1,n):
    if a[i]==a[i-1]:
        dp[a[i]]=1

for i in a:
    for j in range(i*2,ma+1,i):
        #if dp[j]==1:
            #break
        dp[j]=1
        
ans = 0
for i in a:
    if dp[i]==0:
        ans+=1
        
print(ans)
n = int(input())
a = list(map(int, input().split()))
a.sort()
dp = [0]*(1000000+1)
cnt = 0
for i in range(len(a)):
  if dp[a[i]]==1:
    continue
  j = 2
  while(a[i]*j<=a[-1]):
    dp[a[i]*j] = 1
    j += 1
  if i!=len(a)-1 and a[i+1]==a[i]:
    dp[a[i]] = 1
    continue
  cnt += 1
  dp[a[i]] = 1
print(cnt)
n,*a=map(int,open(0).read().split())
a.sort()
b=[0]*(10**6+1)
for i in a:
    b[i]+=1
    if b[i]==1:
        for j in range(2*i,10**6+1,i):
            b[j]+=100
print(b.count(1))
n = int(input())
a = list(map(int, input().split()))
a.sort()
flag = [True] * (a[-1] + 1)
memo = -1
for i in a:
    if memo == i:
        flag[i] = False
        continue
    memo = i
    tmp = 2 * i
    while tmp <= a[-1]:
        flag[tmp] = False
        tmp += i
ans = 0
for i in a:
    if flag[i]: ans += 1
print(ans)
M=10**7
_,*l=map(int,open(0).read().split())
a=[0]*M
for i in sorted(l):
  a[i]+=1
  if a[i]==1:
    for j in range(2*i,M,i):a[j]+=9
print(a.count(1))
n=int(input())
a=list(map(int,input().split()))

a.sort()
amax=max(a)
dp=[True]*(amax+1)

import collections
c = collections.Counter(a)

d=[]
for ck,cv in c.items():
    if cv>=2:
       d.append(ck) 
dset=set(d)
    
aa=set()
for ai in a:
    if dp[ai]:
        aa.add(ai)
        for aj in range(ai*2,amax+1,ai):
            dp[aj]=False

aa=aa-dset    
print(len(aa))
import numpy as np
from collections import Counter


n = int(input())
A = list(map(int, input().split()))
A.sort()
is_divisible = np.zeros(10**6+1, dtype=np.int64)


def update(num):
    nums = np.arange(num, 10**6+1, num)
    is_divisible[nums] = True

counter = Counter(A)
ans = 0
for a, count in counter.items():
    if count == 1 and not is_divisible[a]:
        ans += 1
        
    update(a)

print(ans)
import math , sys

N = int( input() )
A = list( map( int, input().split() ))
A.sort()
Cs = [0 for _ in range(10**6+1)]
M = A[-1]
#print(A)
i=0
M = max(A)
for i in range(N):
    e = A[i]
    if Cs[e]==1:
        Cs[e]=2
    elif Cs[e]==0:
        Cs[e]=1

for i in range(len(Cs)):
    Cs[i] = Cs[i]%2

for e in A:
    i = 2
    while e*i <= M:
        Cs[e*i] = 0
        i+=1
ans = sum(Cs)
print(ans)
n = int(input())
a = list(map(int, input().split()))
a.sort()
m = a[-1]
c = [0] * (m + 1)

for ai in a:
    for i in range(ai, m + 1, ai):
        c[i] += 1

ans = 0
for ai in a:
    if c[ai] == 1:
        ans += c[ai]

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

is_divided = [0]*MAX 
is_appeared = [0]*MAX

for i in range(n):
  if not is_divided[a[i]]:
    if not is_appeared[a[i]]:
      is_appeared[a[i]] = 1
      k = a[i]*2
      while k < MAX:
        is_divided[k] = 1
        k += a[i]
    else:
      is_divided[a[i]] = 1
      
ans = 0      
for i in range(n):
  if not is_divided[a[i]]:
    ans += 1
print(ans)
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter
from operator import mul
from functools import reduce

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

a.sort()

count = Counter(a)

b = [1]*(max(a) + 1)

for aa in a:
    for j in range(2*aa,len(b), aa):
        b[j] = 0

c = 0
for d in count.items():
    if d[1] == 1 and b[d[0]] == 1: c += 1

print(c)