N = int(eval(input()))

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



ma = max(A)

Er = [0 for _ in range(ma + 5)]



for i in range(N):

    temp = A[i]

    if Er[temp] != 2:

        a = 0

        while(1):

            a += 1

            tt = a * temp

            if tt >= ma + 5:

                break

            Er[tt] += 1

        

ans = 0

for i in range(N):

    temp = A[i]

    if Er[temp] == 1:  ans += 1

        

print(ans)
N = int(eval(input()))

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

ma = max(A)

l = [0 for _ in range(ma + 10)]

for i in range(N):

    temp = A[i]

    while(temp <= ma + 5):

        l[temp] += 1

        temp += A[i]

ans = 0

for i in range(N):

    if l[A[i]] == 1:  ans += 1

print(ans)
N = int(eval(input()))
A = list(map(int, input().split()))
ma = max(A)
Er = [0 for _ in range(ma + 5)]
for i in range(N):
    temp = A[i]
    if Er[temp] != 2:
        a = 0
        while 1:
            a += 1
            tt = a * temp
            if tt >= ma + 5:
                break
            Er[tt] += 1
ans = 0
for i in range(N):
    temp = A[i]
    if Er[temp] == 1:
        ans += 1
print(ans)

N = int(eval(input()))
A = list(map(int, input().split()))
ma = max(A)
l = [0 for _ in range(ma + 10)]
for i in range(N):
    temp = A[i]
    while temp <= ma + 5:
        l[temp] += 1
        temp += A[i]
ans = 0
for i in range(N):
    if l[A[i]] == 1:
        ans += 1
print(ans)

-Er = [0 for _ in range(ma + 5)] +l = [0 for _ in range(ma + 10)] -    if Er[temp] != 2: -        a = 0 -        while 1: -            a += 1 -            tt = a * temp -            if tt >= ma + 5: -                break -            Er[tt] += 1 +    while temp <= ma + 5: +        l[temp] += 1 +        temp += A[i] -    temp = A[i] -    if Er[temp] == 1: +    if l[A[i]] == 1: