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

N = int(eval(input()))

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

M = max(As)+1

cnt = [0 for _ in range(M)]



for A in As:

  if cnt[A] != 0:

    cnt[A] = 2

    continue

  for n in range(A, M, A): cnt[n] += 1



ans = 0

for A in As:

  if cnt[A] == 1:

    ans += 1



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

N = int(eval(input()))
As = list(map(int, input().split()))
M = max(As) + 1
cnt = [0 for _ in range(M)]
for A in As:
    if cnt[A] != 0:
        cnt[A] = 2
        continue
    for n in range(A, M, A):
        cnt[n] += 1
ans = 0
for A in As:
    if cnt[A] == 1:
        ans += 1
print(ans)

-A_list = list(map(int, input().split())) -M = max(A_list) + 1 +As = list(map(int, input().split())) +M = max(As) + 1 -for i in A_list: -    if cnt[i] != 0: -        cnt[i] = 2 +for A in As: +    if cnt[A] != 0: +        cnt[A] = 2 -    for j in range(i, M, i): -        cnt[j] += 1 +    for n in range(A, M, A): +        cnt[n] += 1 -for k in A_list: -    if cnt[k] == 1: +for A in As: +    if cnt[A] == 1: