n = int(eval(input()))

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

nux = max(A)

B = set(A)

A.sort()

ans = 0

table = [True]*(nux+1)

for ii, s in enumerate(A):

    if table[s] == False:

        continue

    if ii == n-1:

        ans += 1

    elif A[ii+1] != s:

        ans += 1

    i = 1

    while i*s <= nux:

        table[i*s] = False

        i += 1



print(ans)

n = int(eval(input()))

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

nux = A[-1]+1

ans = 0

table = [True]*nux

for i, s in enumerate(A):

    if table[s] == False:

        continue

    if i == n-1:

        ans += 1

    elif A[i+1] != s:

        ans += 1

    b = 1

    while b*s < nux:

        table[b*s] = False

        b += 1

print(ans)

n = int(eval(input()))
A = list(map(int, input().split()))
nux = max(A)
B = set(A)
A.sort()
ans = 0
table = [True] * (nux + 1)
for ii, s in enumerate(A):
    if table[s] == False:
        continue
    if ii == n - 1:
        ans += 1
    elif A[ii + 1] != s:
        ans += 1
    i = 1
    while i * s <= nux:
        table[i * s] = False
        i += 1
print(ans)

n = int(eval(input()))
A = sorted(map(int, input().split()))
nux = A[-1] + 1
ans = 0
table = [True] * nux
for i, s in enumerate(A):
    if table[s] == False:
        continue
    if i == n - 1:
        ans += 1
    elif A[i + 1] != s:
        ans += 1
    b = 1
    while b * s < nux:
        table[b * s] = False
        b += 1
print(ans)

-A = list(map(int, input().split())) -nux = max(A) -B = set(A) -A.sort() +A = sorted(map(int, input().split())) +nux = A[-1] + 1 -table = [True] * (nux + 1) -for ii, s in enumerate(A): +table = [True] * nux +for i, s in enumerate(A): -    if ii == n - 1: +    if i == n - 1: -    elif A[ii + 1] != s: +    elif A[i + 1] != s: -    i = 1 -    while i * s <= nux: -        table[i * s] = False -        i += 1 +    b = 1 +    while b * s < nux: +        table[b * s] = False +        b += 1