n = int(eval(input()))

a = [int(i) for i in input().split()]

table = [True for _ in range(2 * (10 ** 6))]

a.sort()

ans = 0

for i in range(n):

    if table[a[i]]:

        for j in range(a[i], 2 * (10 ** 6), a[i]):

            table[j] = False

        if i + 1 < n:

            if a[i + 1] != a[i]:

                ans += 1

        elif i + 1 == n:

            ans += 1

print(ans)
T = 10 ** 6 + 20

n = int(eval(input()))

a = [int(i) for i in input().split()]

table = [True for _ in range(T)]

a.sort()

ans = 0

for i in range(n):

    if table[a[i]]:

        for j in range(a[i], T, a[i]):

            table[j] = False

        if i + 1 < n:

            if a[i + 1] != a[i]:

                ans += 1

        elif i + 1 == n:

            ans += 1

print(ans)

n = int(eval(input()))
a = [int(i) for i in input().split()]
table = [True for _ in range(2 * (10**6))]
a.sort()
ans = 0
for i in range(n):
    if table[a[i]]:
        for j in range(a[i], 2 * (10**6), a[i]):
            table[j] = False
        if i + 1 < n:
            if a[i + 1] != a[i]:
                ans += 1
        elif i + 1 == n:
            ans += 1
print(ans)

T = 10**6 + 20
n = int(eval(input()))
a = [int(i) for i in input().split()]
table = [True for _ in range(T)]
a.sort()
ans = 0
for i in range(n):
    if table[a[i]]:
        for j in range(a[i], T, a[i]):
            table[j] = False
        if i + 1 < n:
            if a[i + 1] != a[i]:
                ans += 1
        elif i + 1 == n:
            ans += 1
print(ans)

+T = 10**6 + 20 -table = [True for _ in range(2 * (10**6))] +table = [True for _ in range(T)] -        for j in range(a[i], 2 * (10**6), a[i]): +        for j in range(a[i], T, a[i]):