
import Debug.Trace
import Data.Array
import Data.List

get :: IO (Int, Array Int Int)
get = do
  n <- read <$> getLine
  ary <- (listArray (1,n) . map read . words) <$> getLine
  pure (n, ary)

maximum' as = foldl1 f $ assocs as
  where
    f (i,x) (j,y)
      | x == y = (i,x)
      | x > y = (i,x)
      | y > x = (j,y)

maximum'' as = foldl1 f $ assocs as
  where
    f (i,x) (j,y)
      | x == y = (j,y)
      | x > y = (i,x)
      | y > x = (j,y)

solve :: Int -> Array Int Int -> Array Int Int
solve n as = solve' as cs'
  where
    cs' = listArray (1,n) $ repeat 0
    (i,x) = maximum' as
    (j,y) = maximum'' as
    solve' as cs = 
      if y > 0 then
        solve' (as // [(j,y - 1)]) (cs // [(i, (cs ! i) + 1)])
      else
        cs
      where
        (i,x) = maximum' as
        (j,y) = maximum'' as


main = do
  as <- (uncurry solve) <$> get
  mapM_ print as 
