n = int(eval(input()))

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

a.sort()



cnt = [0] * (a[-1] + 1)

for i in range(n):

    cnt[a[i]] += 1



ans = 0

for i in range(1, a[-1] + 1):

    if cnt[i] > 0:

        if cnt[i] == 1:

            ans += 1

        for j in range(2, a[-1] + 1):

            na = i * j

            if na <= a[-1]:

                cnt[na] = 0

            else:

                break



print(ans)

n = int(eval(input()))

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



b = [0] * (max(a) + 1)

# b[i] = (aの要素がiであるような数)

for i in range(n):

    b[a[i]] += 1



ans = 0

for i in range(1, len(b)):

    if b[i] > 0:

        if b[i] == 1:

            ans += 1

        # print(i, ans)

        for j in range(len(b)):

            if i * j >= len(b):

                break

            b[i * j] = 0



print(ans)

n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
cnt = [0] * (a[-1] + 1)
for i in range(n):
    cnt[a[i]] += 1
ans = 0
for i in range(1, a[-1] + 1):
    if cnt[i] > 0:
        if cnt[i] == 1:
            ans += 1
        for j in range(2, a[-1] + 1):
            na = i * j
            if na <= a[-1]:
                cnt[na] = 0
            else:
                break
print(ans)

n = int(eval(input()))
a = list(map(int, input().split()))
b = [0] * (max(a) + 1)
# b[i] = (aの要素がiであるような数)
for i in range(n):
    b[a[i]] += 1
ans = 0
for i in range(1, len(b)):
    if b[i] > 0:
        if b[i] == 1:
            ans += 1
        # print(i, ans)
        for j in range(len(b)):
            if i * j >= len(b):
                break
            b[i * j] = 0
print(ans)

-a.sort() -cnt = [0] * (a[-1] + 1) +b = [0] * (max(a) + 1) +# b[i] = (aの要素がiであるような数) -    cnt[a[i]] += 1 +    b[a[i]] += 1 -for i in range(1, a[-1] + 1): -    if cnt[i] > 0: -        if cnt[i] == 1: +for i in range(1, len(b)): +    if b[i] > 0: +        if b[i] == 1: -        for j in range(2, a[-1] + 1): -            na = i * j -            if na <= a[-1]: -                cnt[na] = 0 -            else: +        # print(i, ans) +        for j in range(len(b)): +            if i * j >= len(b): +            b[i * j] = 0