import qualified Data.ByteString.Char8 as B
import Data.Maybe
import Data.List
main=putStrLn.unwords.map show.solve.sort.map(fst.fromJust.B.readInt).B.words=<<B.getContents
solve(_:xs)=((\x y->[max(signum y)x,min(x+y)8])<$>f.takeWhile(<8)<*>length.dropWhile(<8)).map(`div`400)$xs
f[]=0
f(x:xs)=1+f(dropWhile(==x)xs)