al=[0]*13

eval(input())

for i in input().split():

    al[int(i)//400]+=1

tuyoi=sum(al[8:])

iru=sum([1 for a in al[:8] if a > 0])

print((max(1,iru),iru+tuyoi))
l=[0]*13

eval(input())

for i in input().split():

  l[int(i)//400]+=1

r=sum([1 for a in l[:8] if a > 0])

print((max(1,r),r+sum(l[8:])))
al = [0] * 13
eval(input())
for i in input().split():
    al[int(i) // 400] += 1
tuyoi = sum(al[8:])
iru = sum([1 for a in al[:8] if a > 0])
print((max(1, iru), iru + tuyoi))

l = [0] * 13
eval(input())
for i in input().split():
    l[int(i) // 400] += 1
r = sum([1 for a in l[:8] if a > 0])
print((max(1, r), r + sum(l[8:])))

-al = [0] * 13 +l = [0] * 13 -    al[int(i) // 400] += 1 -tuyoi = sum(al[8:]) -iru = sum([1 for a in al[:8] if a > 0]) -print((max(1, iru), iru + tuyoi)) +    l[int(i) // 400] += 1 +r = sum([1 for a in l[:8] if a > 0]) +print((max(1, r), r + sum(l[8:])))