INF=10**6+1

n,*l=list(map(int,open(0).read().split()))

from collections import *

c=Counter(l)

l=sorted(c.keys())

a=[]

b=[0]*INF

for i in l: b[i]=1  

for i in l:

  if b[i]:

    if c[i]<2: a+=[i]

    for j in range(2*i,INF,i): b[j]=0

print((len(a)))
M=10**6+1

_,*l=list(map(int,open(0).read().split()))

b=[0]*M

for i in l: b[i]+=1

a=[]

for i in sorted(l):

  if b[i]:

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

    for j in range(i,M,i): b[j]=0

print((len(a)))
INF = 10**6 + 1
n, *l = list(map(int, open(0).read().split()))
from collections import *

c = Counter(l)
l = sorted(c.keys())
a = []
b = [0] * INF
for i in l:
    b[i] = 1
for i in l:
    if b[i]:
        if c[i] < 2:
            a += [i]
        for j in range(2 * i, INF, i):
            b[j] = 0
print((len(a)))

M = 10**6 + 1
_, *l = list(map(int, open(0).read().split()))
b = [0] * M
for i in l:
    b[i] += 1
a = []
for i in sorted(l):
    if b[i]:
        if b[i] == 1:
            a += [i]
        for j in range(i, M, i):
            b[j] = 0
print((len(a)))

-INF = 10**6 + 1 -n, *l = list(map(int, open(0).read().split())) -from collections import * - -c = Counter(l) -l = sorted(c.keys()) +M = 10**6 + 1 +_, *l = list(map(int, open(0).read().split())) +b = [0] * M +for i in l: +    b[i] += 1 -b = [0] * INF -for i in l: -    b[i] = 1 -for i in l: +for i in sorted(l): -        if c[i] < 2: +        if b[i] == 1: -        for j in range(2 * i, INF, i): +        for j in range(i, M, i):