a=[0]*9;input()
for x in list(map(int,input().split())):a[x//400]=1 if x<3200 else a[8]+1
b=sum(a[:8]);print(b,b*(b in[0,8])ora=[0]*9;input()
for x in list(map(int,input().split())):
    if x<3200:a[x//400]=1
    else:a[8]+=1
b=sum(a[:8]);print(b,b*(b==8)or b+a[8]) b+a[8])