import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as V
main=putStrLn.unwords.map show.solve.unfoldr(B.readInt.B.dropWhile isSpace)=<<B.getContents
solve(n:as)=[max k$min 1 m,k+m]::[Int]where
  k=V.foldl(\s x->s+min 1 x)0.V.init$xs
  m=V.last xs
  xs=V.accum(+)(V.replicate 9 0)$map(\a->(min 8$a`div`400,1))as