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

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

m = max(A) + 1

cnt = [0]*m

for i in A:

    cnt[i] += 1

ans = 0

for i in range(1,m):

    if cnt[i]:

        if cnt[i]==1:

            ans += 1

        for j in range(i,m,i):

            cnt[j] = 0

print(ans)
N = int(eval(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(eval(input()))
A = list(map(int, input().split()))
m = max(A) + 1
cnt = [0] * m
for i in A:
    cnt[i] += 1
ans = 0
for i in range(1, m):
    if cnt[i]:
        if cnt[i] == 1:
            ans += 1
        for j in range(i, m, i):
            cnt[j] = 0
print(ans)

-D = [0] * (10**6 + 1) -A.sort() -for i in range(N): -    D[A[i]] += 1 +m = max(A) + 1 +cnt = [0] * m +for i in A: +    cnt[i] += 1 -for i in range(1, 10**6 + 1): -    if D[i]: -        if D[i] == 1: +for i in range(1, m): +    if cnt[i]: +        if cnt[i] == 1: -        for j in range(i, A[-1] + 1, i): -            D[j] = 0 +        for j in range(i, m, i): +            cnt[j] = 0