n=int(eval(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)
from collections import Counter

max_=10**6+1

ans=0



n=int(eval(input()))

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



b=[True]*(max_+1)

data.sort()

c=Counter(data)



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)
n = int(eval(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)

from collections import Counter

max_ = 10**6 + 1
ans = 0
n = int(eval(input()))
data = list(map(int, input().split()))
b = [True] * (max_ + 1)
data.sort()
c = Counter(data)
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 Counter + +max_ = 10**6 + 1 +ans = 0 -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 +data = list(map(int, input().split())) +b = [True] * (max_ + 1) +data.sort() +c = Counter(data) +for d in data: +    if b[d]: +        for j in range(d, max_, d): +            b[j] = False +        if c[d] == 1:  # 複数存在考慮 +            ans += 1