n  = int(eval(input()))

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

ok = set()

ng = set()

mul = set()



ans = 0



for i in li:

    if i not in ok:

        ok.add(i)

    else:

        ng.add(i)



M = max(ok)



for i in ok:

    for j in range(2,M+1):

        if i*j > 10**6:

            break

        else:

            mul.add(i*j)



for i in ok:

    if i not in mul:

        if i not in ng:

            ans+=1



print(ans)
N = 1000001

a = [0]* N

eval(input())

for x in input().split():

  a[int(x)] += 1

for i in range(1, N):

  if a[i]:

    for j in range(i + i, N, i):

      a[j] = 0

print((a.count(1)))
n = int(eval(input()))
li = list(map(int, input().split()))
ok = set()
ng = set()
mul = set()
ans = 0
for i in li:
    if i not in ok:
        ok.add(i)
    else:
        ng.add(i)
M = max(ok)
for i in ok:
    for j in range(2, M + 1):
        if i * j > 10**6:
            break
        else:
            mul.add(i * j)
for i in ok:
    if i not in mul:
        if i not in ng:
            ans += 1
print(ans)

N = 1000001
a = [0] * N
eval(input())
for x in input().split():
    a[int(x)] += 1
for i in range(1, N):
    if a[i]:
        for j in range(i + i, N, i):
            a[j] = 0
print((a.count(1)))

-n = int(eval(input())) -li = list(map(int, input().split())) -ok = set() -ng = set() -mul = set() -ans = 0 -for i in li: -    if i not in ok: -        ok.add(i) -    else: -        ng.add(i) -M = max(ok) -for i in ok: -    for j in range(2, M + 1): -        if i * j > 10**6: -            break -        else: -            mul.add(i * j) -for i in ok: -    if i not in mul: -        if i not in ng: -            ans += 1 -print(ans) +N = 1000001 +a = [0] * N +eval(input()) +for x in input().split(): +    a[int(x)] += 1 +for i in range(1, N): +    if a[i]: +        for j in range(i + i, N, i): +            a[j] = 0 +print((a.count(1)))