import Data.List
main=putStrLn.unwords.map show.solve.sort.map(read).words=<<getContents
solve(_:xs)=((\x y->[max(signum y)x,x+y])<$>f.takeWhile(<8)<*>length.dropWhile(<8)).map(`div`400)$xs
f[]=0
f(x:xs)=1+f(dropWhile(==x)xs)