peterverebics/CodeNet_Python_118 huggingface dataset:
import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

num = 10 ** 6 + 1 #適当に値を入れる
L = [0 for i in range(num)]
ans = 0
N = int(input())
A = getlist()
for i in range(N):
	L[A[i]] += 1

for i in range(num):
	if L[i] >= 1:
		if L[i] == 1:
			ans += 1
		c = 2
		while i * c <= num - 1:
			L[i * c] = 0; c += 1

print(ans)
from collections import Counter

n = int(input())
aa = tuple(sorted(map(int, input().split())))
cnt = Counter(aa)
amax = max(aa)
af = [False] * (amax + 1)

ans = 0
for i in range(n):
    x = aa[i]
    if af[x]:
        continue
    while x <= amax:
        af[x] = True
        x += aa[i]
    if cnt[aa[i]] == 1:
        ans += 1

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

# エラトステネスの篩
max_A = A[-1]
search_list = [True for _ in range(max_A)]

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

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

check = [0]*(a_max+1)

for i in a:
    if check[i] != 0:
        check[i] = 2
        continue
    if check[i] == 0:
        check[i] = 1
        for j in range(1,a_max//i):
            check[(j+1)*i] = 2

print(check.count(1))
n=int(input())
a=sorted(list(map(int,input().split())))
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)
N = int(input())
A = list(map(int,input().split()))
ma = max(A)
l = [0 for _ in range(ma + 10)]
for i in range(N):
    temp = A[i]
    while(temp <= ma + 5):
        l[temp] += 1
        temp += A[i]
ans = 0
for i in range(N):
    if l[A[i]] == 1:  ans += 1
print(ans)
#!/usr/bin python3
# -*- coding: utf-8 -*-

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

    primes = set(A)
    for ind,i in enumerate(A):
        primes.difference_update(range(i*2, n+1, i))
        if ind>=1:
            if A[ind]==A[ind-1]:
                primes -= {i}
    print(len(primes))



if __name__ == '__main__':
    main()
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

from math import sqrt
from collections import Counter, deque
N = int(input())
As = list(mapint())
As.sort()
C = Counter(As)
S = set()

MAX = As[-1]
cnt = 0
for n in range(N):
    p = As[n]
    if p in S:
        continue
    i = 1
    while MAX>=p*i:
        S.add(p*i)
        i += 1
    if C[p]>=2:
        continue
    cnt += 1

print(cnt)
import numpy as np
n = int(input())
A = list(map(int,input().split()))
A.sort()
Amax = A[-1]

A = np.array(A)

judge = np.zeros(Amax+1,int)
judge[A]=1

for i in range(n):
    if not judge[A[i]]: continue
    if i<n-1 and A[i]==A[i+1]:
        judge[A[i]] = 0
    judge[np.arange(2,Amax//A[i]+1) * A[i]] = 0

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

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

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

for i in sorted(arr):
    dp[i] += 1
    if dp[i] == 1:
        for j in range(2*i, len(dp), i):
            dp[j] += 2
print(dp.count(1))
N = int(input())
A_list = list(map(int, input().split()))
M = max(A_list)+1
cnt = [0 for _ in range(M)]

for i in A_list:
    if cnt[i] != 0:
        cnt[i] = 2
        continue
    for j in range(i, M, i): cnt[j] += 1

ans = 0
for k in A_list:
    if cnt[k] == 1: ans += 1
print(ans)
x = int(input())
p = sorted(list(map(int,input().split())))
d = [True]*(p[-1]+1)
e = [False]*(p[-1]+1)
for i in p:
    if e[i]:
        d[i] = False
        continue
    else:
        e[i] = True
    idx = 2*i
    while idx < len(d):
        d[idx] = False
        idx += i

cnt = 0
for i in p:
    cnt += int(d[i])    
print(cnt)
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
A.sort()
c = Counter(A)
lst = [1] * (10**6+1)
res = 0

for i,a in enumerate(A):
  if lst[a] == 0: continue
  if i==N-1 or A[i+1] != a:
    res += 1
  for j in range(a, 10**6+1, a):
    lst[j] = 0

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

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

for i in A:
    if l[i] <= 1:
        for j in range(0,10**6+1,i):
            l[j] += 1
count = 0
for i in A:
    if l[i] == 1:
        count += 1
print(count)
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
    else:
        for j in range(2*num, A[-1]+1, num):
            dp[j] = False

print(len([i for i in A if dp[i]]))
from collections import Counter


def solve(string):
    n, *a = map(int, string.split())
    table = [True] * (10**6 + 1)
    ma = max(a)
    for _a in a:
        if table[_a]:
            for i in range(2 * _a, ma + 1, _a):
                table[i] = False
    return str(sum(table[k] for k, v in Counter(a).items() if v == 1))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
N = int(input())
A = list(map(int, input().split()))
A.sort()

A_max = max(A)
dp = [True] * (A_max + 1)
count = 0
A_f = {a: 0 for a in A}
for a in A:
    A_f[a] += 1

for a in A:
    if dp[a]:
        for i in range(1, A_max + 1):
            if a * i > A_max:
                break
            dp[a * i] = False
        if A_f[a] == 1:
            count += 1

print(count)
from collections import Counter

N,*A = map(int, open(0).read().split())
As = sorted(A)
Ac = Counter(A)
m = max(A)
dp = [True] * (m+1)
ans = 0
for x in As:
    if dp[x] == True:
        for i in range(1,m//x+1):
            dp[x*i] = False
        if Ac[x] == 1:
            ans += 1
    else:
        continue
print(ans)
# print('input >>')
N = int(input())
As = list(map(int,(input().split())))

As.sort()
# print(As)

all_nums = [0] * (As[-1] + 1)

for A in As:
    all_nums[A] += 1

dup = 0

for i, num in enumerate(all_nums):
    if num == 0:
        continue
    if num > 1:
        dup += num
    j = 2
    while i * j <= As[-1]:
        all_nums[i*j] = 0
        j += 1
    # print(all_nums)

print(sum(all_nums)-dup)
n = int(input())
arr = list(map(int,input().split()))

nums = list(set(arr))
nums.sort()
last = nums[-1]
from collections import Counter
arr = Counter(arr)
ans = 0

for i in nums:
    if arr[i] == 1:
        ans += 1
    for j in range(last//i+1):
        del arr[i*j]

print(ans)
d=[0]*8**7
for j in[*open(0)][1].split():d[int(j)]+=1
i=0
while i<1e6:
 i+=1;j=i
 while j<1e6:j+=i;d[j]*=d[i]<1
print(d.count(1))
n = int(input())
a = list(map(int,input().split()))
a.sort()
amax = a[-1]
flags = [True] * amax

prev = -1

cnt = 0
for idx in range(n):
    i = a[idx]
    if prev == i: continue
    if flags[i-1]: 
        cnt += 1
        if idx < n-1:
            if i == a[idx+1]:
                cnt -= 1
    ax = i + i
    while ax <= amax:
        flags[ax-1] = False
        ax += i
    prev = i
print(cnt)
n=int(input())
a=list(map(int,input().split()))
a=sorted(a)
b=list(set(a))
m=len(b)

p=[0]*(10**6+1)
for i in b:
    if p[i]==0:
        j=2
        while i*j<=10**6:
            p[i*j]=1
            j+=1
a.append(-1)
a.insert(0,-1)
ans=0
for i in range(1,n+1):
    if a[i]!=a[i+1] and a[i]!=a[i-1] and p[a[i]]==0:
        ans+=1
print(ans)
n=int(input())
a=list(map(int,input().split()))
a.sort()
e=[1]*(10**6+1)
from collections import Counter
d=Counter(a)
ans=0
for i in a:
  if d[i]==1 and e[i]==1:ans+=1
  if e[i]==1:
    for j in range(i,10**6+1,i):e[j]=0
print(ans)
N = int(input())
A = sorted(list(map(int, input().split())))
THE_NUM = 10**6 + 1

dp = [True] * THE_NUM

prev_num = -1
for i in A:
  # if the same number appears as before, that number cannot be counted in the answer.
  if prev_num != i:
    for j in range(i * 2, THE_NUM, i):
      dp[j] = False
  else:
    dp[i] = False
  prev_num = i

ans = 0
for i in A:
  # the same number after the second will not counted in the answer.
  if dp[i] == True:
    ans += 1

print(ans)
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
m = 1000001

count = 0
cnt = [0] * m
for i in range(n):
  if cnt[a[i]] == 0:
    for j in range(a[i], m, a[i]):
      cnt[j] += 1
  else:
    cnt[a[i]] = 2
for i in range(n):
  if cnt[a[i]] == 1:
    count += 1
print(count)
from collections import Counter
N=int(input())
A=sorted(list(map(int,input().split())))
c=Counter(A)
if 1 in A:
    if c[1]==1:
        print(1)
    else:
        print(0)
    exit()
n=max(A)
ans=[0]*(n+1)
for k,v in c.items():
    if v==1:
        ans[k]=1
for i in c.keys():
    t=i*2
    while t<=n:
        ans[t]=0
        t+=i
print(sum(ans))
from collections import defaultdict
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
count = 0
ap = defaultdict(int)
for i in range(1, n):
    if arr[i] == arr[i-1]:
        ap[arr[i]] = 1
        
for i in range(n):
    if not ap[arr[i]]:
        count += 1
    if i == 0 or arr[i] != arr[i-1]:
        for j in range(arr[i], 1000001, arr[i]):
            ap[j] = 1
print(count)
N = int(input())
A = list(map(int, input().split()))

d = {}
for a in A:
    d.setdefault(a, 0)
    d[a] += 1

A = sorted(set(A))
t = [True] * (10 ** 6 + 1)

for a in A:
    for i in range(a + a, 10 ** 6 + 1, a):
        t[i] = False

for a in d:
    if d[a] > 1:
        t[a] = False

result = 0
for a in A:
    if t[a]:
        result += 1
print(result)
c=[0]*8**7
for a in[*open(0)][1].split():c[int(a)]+=1
i=r=0
for t in c:
 if t:c[::i]=[0]*-(-8**7//i)
 i+=1;r+=t==1
print(r)
N=int(input())
ls=list(map(int,input().split()))
ls.sort()

#定数倍のやつに＋１する
M=max(ls)
A=[0]*(M+1)
for i in range(N):
  a=M//ls[i]
  for j in range(1,a+1):
    if A[ls[i]]>=2:
      break
    else:
      A[j*ls[i]]+=1
  continue  
ans=0     
for i in range(len(ls)):
  if A[ls[i]]==1:
    ans+=1
print(ans)
import sys
readline = sys.stdin.buffer.readline

n = int(readline())
a = list(map(int,readline().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())
arr=list(map(int,input().strip().split()))
arr.sort()
maxi=arr[-1]
booll=[True]*(maxi+1)
r=0
for i in range(n-1):
    a=arr[i]
    if(booll[a]==True):
        for j in range(a,maxi+1,a):
            booll[j]=False
        if(a<arr[i+1]):
            r=r+1
if(booll[arr[n-1]]==True):
    r=r+1
print(r)
N = int(input())
A = list(map(int,input().split()))
M = 1000005
l = [0 for i in range(M)]

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

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

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

print(ans)
n = int(input())
a = list(map(int,input().split()))
r = [0 for _ in range(max(a)+1)]
l = [0 for _ in range(max(a)+1)]
ans = n
for i in a:
    r[i] += 1
    l[i] = 1
for i in range(len(r)):
    if r[i]:
        if 1 < r[i]:
            l[i] = 0
        for j in range(2*i,len(r),i):
            if r[j]:
                l[j] = 0
print(sum(l))
A=int(input())
S=list(map(int,input().split()))
tmp=set()
aft=set()
for i in S:
   if i in aft:
      tmp.add(i)
   else:
      aft.add(i)
n=max(S)+1
DP=[1]*n
for i in aft:
   if i in tmp:
      DP[i]=0
   for j in range(2*i,n,i):
      DP[j]=0
ans=0
for i in S:
   ans+=DP[i]
print(ans)
n = int(input())
A = list(map(int,input().split()))
 
maxA = max(A)
ans = 0
flag = [0]*(maxA+1)
 
# print(flag)
for a in A:
    for ax in range(a,maxA+1,a):
        flag[ax] +=1
 
# print(flag)
for a in set(A):
    if flag[a] == 1:
        ans += 1
print(ans)
N = int(input())
A = sorted(list(map(int, input().split())))

max_A = A[-1]
# df[i]...数字iが条件満たす:1、条件満たさない:0
df = [True for _ in range(max_A + 1)]

for i, a in enumerate(A):
    if i > 0:
        if A[i] == A[i - 1]:
            df[a] = False
            continue
    if df[a]:
        for num in range(2*a, max_A+1, a):
            df[num] = False
count = 0
for a in A:
    if df[a]:
        count += 1
print(count)
from collections import Counter
def main():
    n = int(input())
    A = list(map(int, input().split()))
    A.sort()
    p = set()
    no_count = set([k for k, v in Counter(A).items() if v >= 2])
    ans = 0
    for a in A:
        if a not in p:
            b = a
            while b <= A[-1]:
                p.add(b)
                b += a
            if a not in no_count:
                ans += 1
    print(ans)





if __name__ == '__main__':
    main()
N = int(input())
A = list(map(int,input().split()))
U = [0]*(10**6+1)
for e in A:
    U[e] += 1
ans = 0
for k in range(1,max(A)+1):
    if U[k] == 1:
        ans += 1
    if U[k] > 0:
        for l in range(2*k,10**6+1,k):
            if U[l] > 0:
                U[l] += 1
print(ans)
import sys
input = sys.stdin.readline

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

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

for a in A:
    LIST[a]+=1
ANS=0

for i in range(10**6+1):
    if LIST[i]==1:
        ANS+=1
    if LIST[i]!=0:
        for j in range(2*i,10**6+1,i):
            if LIST[j]!=0:
                LIST[j]+=1
print(ANS)
N = int(input())
A = list(map(int, input().split()))
A.sort()

max_A = A[-1] + 1
ans = [0] * max_A

for i in A:
    ans[i] += 1
    if ans[i] == 1:
        for j in range(i*2, max_A, i):
            ans[j] = 2

print(ans.count(1))
n = int(input())
a = list(map(int, input().split()))
m = max(a)
y = [0] * (m + 1)
for i in a:
    x = i
    while x <= m:
        y[x] += 1
        x += i
ans = 0
for j in a:
    if y[j] == 1:
        ans += 1

print(ans)
import numpy as np
 
n = int(input())
a = list(map(int, input().split()))
a.sort()
dp = [0 for _ in range(a[-1] + 1)]

for x in a:
    for j in range(x, a[-1] + 1, x):
        dp[j] += 1
ans = 0
for x in set(a):
    #print(x)
    if dp[x] == 1:
        ans += 1
print(ans)
n = int(input())
a = list(map(int,input().split()))

m = max(a)
#約分できちゃう数値リスト
lis = [0]*(m + 1)
for i in a:
  for j in range(i, m + 1, i):
    lis[j] += 1
#iが1なら、lisの要素全てに+1されてる。
count = 0
for i in a:
  if lis[i] == 1:
    count += 1
    
print(count)
def main():

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

    from collections import Counter
    C = Counter(A)
    #print(C)

    M = max(A)

    X = [0]*(M+1)
    for i in A:
        j = i*2
        while j <= M:
            X[j] = 1
            j += i
    #print(X)

    ans = 0
    for a in A:
        if C[a] == 1 and X[a] != 1:
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()
import sys
input = sys.stdin.readline
import math

n = map(int, input())
a = list(map(int, input().split()))
N = 1000005
b = [0] * N

for x in a:
    if b[x] == 0:
        for y in list(range(2 * x, N, x)):
            b[y] += 1
    b[x] += 1

ans = 0
for x in a:
    if b[x] == 1:
        ans += 1
print(ans)
n = int(input())
lst = list(map(int, input().split()))
lst.sort()
k = lst[-1]+1
dp = [0 for i in range(k)]
ans = 0
for i in lst:
    if dp[i] == 0:
        ans += 1
        dp[i] = 2
        for j in range(i*2, k, i):
            dp[j] = 1
    elif dp[i] == 2:
        dp[i] = 1
        ans -= 1
print(ans)
n = int(input())
a = list(map(int, input().split()))
a.sort()
if a[0]==1:
    if n==1 or a[1]>1:
        print(1)
    else:
        print(0)
    exit(0)
ok = [True]*(10**6+1)
ans = 0
pre = -1
for i in a:
    if not ok[i]:
        continue
    if i==pre:
        ok[i] = False
        continue
    pre = i
    for j in range(i*2, 10**6+1, i):
        ok[j] = False
for i in a:
    if ok[i]:
        ans += 1
print(ans)
import numpy as np
from collections import Counter


def solve(string):
    n, *a = map(int, string.split())
    table = np.array([True] * (10**6 + 1))
    for _a in a:
        if table[_a]:
            table[2*_a::_a]=False
    i = np.array([k for k,v in Counter(a).items() if v==1],dtype=np.int)
    return str(table[i].sum())


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
# coding: utf-8
# Your code here!
N=int(input())
A=list(map(int,input().split()))
A.sort()

log=[0]*10**6
ans=len(A)

for a in A:
    if log[a-1]==0:
        log[a-1]=-1
        for index in range(a-1+a,10**6,a):
            log[index]=1
    elif log[a-1]==-1:
        log[a-1]=1
        ans-=2
    else:
        ans-=1

print(ans)
N = int(input())
c=[0]*8**7
for a in input().split():
    c[int(a)] += 1
i=r=0
for t in c:
    if t:
        c[::i]=[0]*-(-8**7//i)
    i+=1
    r+=t==1
print(r)
import sys 
import numpy as np
from numba import jit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


@jit(cache=True)
def solve(A):
  count = np.zeros(10**6+10)
  for x in A:
    if count[x] > 1:
      continue
    count[::x] += 1
  ans = 0
  for x in A:
    ans += count[x] == 1
  return ans

N = int(readline())
A = list(map(int,readline().split()))
A = np.array(A)
print(solve(A))
import math
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
maxi = max(a)
a.sort()

div = [0] * (maxi + 1)
for n in a:
    div[n] += 1
    if div[n] == 1:
        for j in range(n*2, maxi + 1, n):
            div[j] += 100
print(div.count(1))
n=int(input())
a=list(map(int,input().split()))
a.sort()

cnt=[0]*(a[-1]+1)
#cntは0が25個続くリスト
for x in a:
  #xは3,8,11,16,24
 for i in range(x,a[-1]+1,x):
  #x = 3ならrange(3, 25, 3) = 3, 6, 9, 12, 15, 18, 21, 24
  
  cnt[i]+=1
  #xの倍数(xを含む)だったら1が足される
ans=0
for x in a:
 if cnt[x]==1:
  ans+=1
print(ans)
n,a=int(input()),sorted(list(map(int,input().split())))
m=a[-1]+n
dp=[0]*m
for i in a:dp[i]+=1
for i in set(a):
    if dp[i]:
        for j in range(i*2,m,i):
            dp[j]=0

print(dp.count(1))
N = int(input())
A = list(map(int,input().split()))
m = max(A)
U = [0]*(m+1)
for e in A:
    U[e] += 1
ans = 0
for k in range(1,m+1):
    if U[k] == 1:
        ans += 1
    if U[k] > 0:
        for l in range(2*k,m+1,k):
            if U[l] > 0:
                U[l] += 1
print(ans)
from collections import defaultdict
import math
n = int(input())
a = list(map(int,input().split()))
max_a = 10**6 +1 
a = sorted(a)
dic = defaultdict(lambda: False)

count = 0 
for i in range(n):
    ai = a[i]
    if dic[ai] == True:
        count+=1
    else:
        for j in range(1,math.ceil(max_a/ai)):
            dic[j*ai] = True
        if (i+1) < n and a[i]==a[i+1]:
            count+=1
print(n-count)
n=int(input())
a=list(map(int,input().split()))
m=max(a)
aset=set()
dp=[0]*(m+1)
for i in a:
  dp[i]=1
for i in sorted(a):
  if dp[i]!=0:
    for j in range(1,m//i):
      dp[i*(j+1)]=0
for i in a:
  if i in aset:
    dp[i]=0
  else:
    aset.add(i)
print(sum(dp))
from collections import defaultdict

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

bool_list = [True] * (10 ** 6)

duplicate_dic = defaultdict(int)
for a in A:
    duplicate_dic[a] += 1
    if duplicate_dic[a] > 1:
        bool_list[a - 1] = False

for a in A_sort:
    for i in range(2*a, 10 ** 6 + 1, a):
        bool_list[i - 1] = False

print(sum([1 for a in A_sort if bool_list[a - 1]]))
d=[0]*8**7
for i in[*open(0)][1].split():d[int(i)]+=1
i=r=0
while i<1e6:
 i+=1;r+=d[i]==1;j=i
 while j<1e6:j+=i;d[j]*=d[i]<1
print(r)
N = int(input())
# = map(int, input().split())
A = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
# = [list(map(int, input().split())) for i in range(N)]

A = list(sorted(A))
mark = [0]*(10**6+1)

for i in A:
    mark[i] += 1
    if mark[i] == 1:
        for j in range(2*i, len(mark), i):
            mark[j] += 2

print(mark.count(1))
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
L = [0] * (A[-1]+1)
for a in A:
    L[a] = 1

for p in A:
    if not L[p]: continue 
    L[p] += 1
    n = 2
    while p*n <= A[-1]:
        L[p*n] = 0
        n += 1

ans = L.count(2)
print(ans)
from collections import Counter
n = int(input())
A = list(map(int,input().split()))
mx = max(A)
C = Counter(A)
D = {a:True for a in A}
for a in A:
    if C[a]>1: D[a]=False
    for i in range(a*2, mx+1, a):
        D[i]=False
print(sum([D[a] for a in A]))
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
M = 10 ** 6

B = Counter(A)
Key = list(B.keys())
Key.sort()

table = [1] * (M + 1)
cnt = 0
for k in Key:
    if B[k] == 1:
        if table[k] == 1:
            cnt += 1
    for i in range(M):
        if k * i > M:
            break
        else:
            table[k * i] = 0

print(cnt)
n = int(input())

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

c = [0] * (10**6+1)
for i in a:
    c[i] += 1

uni = []
a = list(set(a))

for i in a:
    if c[i] == 1:
        uni.append(i)

b = [0 for _ in range(10**6+1)]

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

cnt = 0
for i in uni:
    if b[i] == 0:
        cnt += 1

print(cnt)
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
p = [True] * (10 ** 6 + 1)
s = list(set(a))
for x in s:
    t = x * 2
    while t <= 10 ** 6:
        p[t] = False
        t += x
ans = 0
for x in a:
    if c[x] == 1 and p[x] == True:
        ans += 1
print(ans)
a = [0]* 1000001
m = 0
input()
for x in map(int, input().split()):
  m = max(m, x)
  a[x] += 1
m += 1
for i in range(1, m):
  if a[i]:
    for j in range(i + i, m, i):
      a[j] = 0
print(a.count(1))
def main():
  N=int(input())
  D=[0]*(10**6+1)
  A=sorted(map(int,input().split()))
  m=max(A)+1

  for a in A:
    if D[a]==0:
      D[a]=1
      for i in range(2*a,m,a):
        D[i]=-1
    else:
      D[a]=-1

  print(D.count(1))

main()
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))
from collections import Counter

n=int(input())
l=lnii()

def eratosthenes(lim):
  num=[1 for i in range(lim)]
  for i in set(l):
    if num[i]:
      for j in range(i+i,lim,i):
        num[j]=0
  return num

lim=10**6+5
num=eratosthenes(lim)

count=Counter(l)

ans=0
for i in l:
  if num[i]==1 and count[i]==1:
    ans+=1

print(ans)
n = int(input())
l = [int(x) for x in input().split()]
l.sort()
set_l = set(l)
set_l = sorted(set_l)
limit = 10**6+1
mp = [0]*(limit)
pre = None
for i in range(n):
    num = l[i]
    if(pre==num):
        mp[num] += 1
    pre = num

for x in set_l:
    for y in range(x,limit,x):
        mp[y] += 1
        

cnt = 0
for num in set_l:
    if(mp[num]==1):
        cnt += 1
print(cnt)
N=int(input())
A=list(map(int, input().split()))

a_max = max(A)
B=[0]*(a_max + 1)

for ai in A:
    for multi in range(ai, a_max+1, ai):
        B[multi] += 1

ans = 0
for ai in A:
    if B[ai] == 1:
        ans += 1

print(ans)
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    B = [0]*(10**6+1)
    for a in A:
        B[a] += 1

    for a in set(A):
        v = 2*a
        while v <= 10**6:
            B[v] += 1
            v += a

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

    print(ans)


if __name__ == '__main__':
    main()
import numpy as np
s = int(input())
l = list(map(int, input().split()))
a = np.zeros(max(l)+1,dtype=int)
n = 0
for i in l:
    a[:: i] += 1

for i in l:
    if a[i] == 1:
        n += 1
print(n)
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
C = Counter(A)
A = set(A)
B = [True] * (10 ** 6 + 1)
for a in A:
    for i in range(2 * a,10**6 + 1 ,a):
        B[i] = False
cnt = 0
for a in A:
    if (B[a] == True) and (C[a] == 1):
        cnt += 1
print(cnt)