N = int(eval(input()))

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



ma = max(A)

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

is_c = [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]

    is_c[temp] += 1

    if is_c[temp] == 2:

        continue  

    if Er[temp] == 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)
Er = [0 for _ in range(ma + 5)]
is_c = [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]
    is_c[temp] += 1
    if is_c[temp] == 2:
        continue
    if Er[temp] == 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)

-is_c = [0 for _ in range(ma + 5)] -    is_c[temp] += 1 -    if is_c[temp] == 2: -        continue