import Control.Monad

main :: IO ()
main = do
  n <- readLn
  if n == 0
    then return ()
    else do
      ls <- replicateM n readLn
      let ans = solve ls
      mapM_ putStrLn ans
      main

solve :: [Int] -> [String]
solve ls = map show (count ls)
  where
    count :: [Int] -> [Int]
    count ls = map (countOf ls) [0..6]
      where
        countOf :: [Int] -> Int -> Int
        countOf l n = foldl f 0 l
          where
            f :: Int -> Int -> Int
            f acc x
              | min (x `div` 10) 6 == n = acc + 1
              | otherwise = acc