n = int(eval(input()))

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



U = 10**6

line = [1]*(U+1)

ans = set()

depricated = set()

cnt = [0]*(U+1)

for a in A:

    cnt[a] += 1

    if cnt[a] == 2 and line[a]:

        depricated.add(a)

        continue

    if 2 < cnt[a]:

        continue

    if line[a]:

        ans.add(a)

        for p in range(2*a, U+1, a):

            line[p] = 0

print((len(ans-depricated)))

n = int(eval(input()))

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

U = A[-1]

line = [1]*(U+1)

ans = set()

depricated = set()

cnt = [0]*(U+1)

for a in A:

    if a in ans:

        depricated.add(a)

        continue

    if line[a]:

        ans.add(a)

        for p in range(2*a, U+1, a):

            line[p] = 0

print((len(ans-depricated)))
n = int(eval(input()))
A = sorted(map(int, input().split()))
U = 10**6
line = [1] * (U + 1)
ans = set()
depricated = set()
cnt = [0] * (U + 1)
for a in A:
    cnt[a] += 1
    if cnt[a] == 2 and line[a]:
        depricated.add(a)
        continue
    if 2 < cnt[a]:
        continue
    if line[a]:
        ans.add(a)
        for p in range(2 * a, U + 1, a):
            line[p] = 0
print((len(ans - depricated)))

n = int(eval(input()))
A = sorted(map(int, input().split()))
U = A[-1]
line = [1] * (U + 1)
ans = set()
depricated = set()
cnt = [0] * (U + 1)
for a in A:
    if a in ans:
        depricated.add(a)
        continue
    if line[a]:
        ans.add(a)
        for p in range(2 * a, U + 1, a):
            line[p] = 0
print((len(ans - depricated)))

-U = 10**6 +U = A[-1] -    cnt[a] += 1 -    if cnt[a] == 2 and line[a]: +    if a in ans: -        continue -    if 2 < cnt[a]: