n = int(eval(input()))

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

a.sort()

furui = [False] * (10**6+1)

ans = 0

for i in range(n):

    if i-1 >= 0 and a[i] == a[i-1]:

        continue

    if furui[a[i]] == False:

        if (i + 1 < n and a[i] != a[i + 1]) or i==n-1:

            ans += 1

        now = a[i]

        while now <= 10**6:

            furui[now] = True

            now += a[i]

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

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

a.sort()

#furui = [False] * (10**6+1)

#ans = 0

#for i in range(n):

#    if i-1 >= 0 and a[i] == a[i-1]:

#        continue

#    if furui[a[i]] == False:

#        if (i + 1 < n and a[i] != a[i + 1]) or i==n-1:

#            ans += 1

#        now = a[i]

#        while now <= 10**6:

#            furui[now] = True

#            now += a[i]

#print(ans)

furui = [0] *(10**6+1)

for i in range(n):

    now = a[i]

    if furui[now] == 1:

        furui[now] = 2

    if furui[now] == 0:

        now_2 = now

        while now_2 <= 10**6:

            furui[now_2]  += 1

            now_2 += now

ans = 0

for i in a:

    if furui[i] == 1:

        ans += 1

print(ans)
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
furui = [False] * (10**6 + 1)
ans = 0
for i in range(n):
    if i - 1 >= 0 and a[i] == a[i - 1]:
        continue
    if furui[a[i]] == False:
        if (i + 1 < n and a[i] != a[i + 1]) or i == n - 1:
            ans += 1
        now = a[i]
        while now <= 10**6:
            furui[now] = True
            now += a[i]
print(ans)

n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
# furui = [False] * (10**6+1)
# ans = 0
# for i in range(n):
#    if i-1 >= 0 and a[i] == a[i-1]:
#        continue
#    if furui[a[i]] == False:
#        if (i + 1 < n and a[i] != a[i + 1]) or i==n-1:
#            ans += 1
#        now = a[i]
#        while now <= 10**6:
#            furui[now] = True
#            now += a[i]
# print(ans)
furui = [0] * (10**6 + 1)
for i in range(n):
    now = a[i]
    if furui[now] == 1:
        furui[now] = 2
    if furui[now] == 0:
        now_2 = now
        while now_2 <= 10**6:
            furui[now_2] += 1
            now_2 += now
ans = 0
for i in a:
    if furui[i] == 1:
        ans += 1
print(ans)

-furui = [False] * (10**6 + 1) +# furui = [False] * (10**6+1) +# ans = 0 +# for i in range(n): +#    if i-1 >= 0 and a[i] == a[i-1]: +#        continue +#    if furui[a[i]] == False: +#        if (i + 1 < n and a[i] != a[i + 1]) or i==n-1: +#            ans += 1 +#        now = a[i] +#        while now <= 10**6: +#            furui[now] = True +#            now += a[i] +# print(ans) +furui = [0] * (10**6 + 1) +for i in range(n): +    now = a[i] +    if furui[now] == 1: +        furui[now] = 2 +    if furui[now] == 0: +        now_2 = now +        while now_2 <= 10**6: +            furui[now_2] += 1 +            now_2 += now -for i in range(n): -    if i - 1 >= 0 and a[i] == a[i - 1]: -        continue -    if furui[a[i]] == False: -        if (i + 1 < n and a[i] != a[i + 1]) or i == n - 1: -            ans += 1 -        now = a[i] -        while now <= 10**6: -            furui[now] = True -            now += a[i] +for i in a: +    if furui[i] == 1: +        ans += 1