n = int(eval(input()))

A = [*list(map(int, input().split()))]

mx = max(A)

c = [0]*(mx+1)

for a in A:

    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)

n = int(eval(input()))

A = [*list(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)

n = int(eval(input()))
A = [*list(map(int, input().split()))]
mx = max(A)
c = [0] * (mx + 1)
for a in A:
    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)

n = int(eval(input()))
A = [*list(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)

+    if c[a]: +        c[a] = 2 +        continue