n = int(eval(input()))

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



x = max(a)

dp = [0] * (x+1)

for ai in a:

    i = 1

    if dp[ai] <= 2:

        while i * ai <= x:

            dp[i * ai] += 1

            i += 1



ans = 0

for ai in a:

    if dp[ai] <= 1:

        ans += 1



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

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



x = max(a)

dp = [0] * (x+1)

for ai in a:

    i = 1

    if dp[ai] <= 2:

        while i * ai <= x:

            dp[i * ai] += 1

            i += 1



ans = 0

for ai in a:

    if dp[ai] <= 1:

        ans += 1



print(ans)
n = int(eval(input()))
a = sorted(list(map(int, input().split())))
x = max(a)
dp = [0] * (x + 1)
for ai in a:
    i = 1
    if dp[ai] <= 2:
        while i * ai <= x:
            dp[i * ai] += 1
            i += 1
ans = 0
for ai in a:
    if dp[ai] <= 1:
        ans += 1
print(ans)

n = int(eval(input()))
a = list(map(int, input().split()))
x = max(a)
dp = [0] * (x + 1)
for ai in a:
    i = 1
    if dp[ai] <= 2:
        while i * ai <= x:
            dp[i * ai] += 1
            i += 1
ans = 0
for ai in a:
    if dp[ai] <= 1:
        ans += 1
print(ans)

-a = sorted(list(map(int, input().split()))) +a = list(map(int, input().split()))