
import qualified Data.Vector as V
import Data.List (sortBy)

import Debug.Trace

type Data = V.Vector (Int,Int)
type Counter = V.Vector Int

get :: IO Data
get = do
  getLine
  (V.fromList . sortBy (\a b -> fst b `compare` fst a) . flip zip [1..] . map read . words)
    <$> getLine

post :: Counter -> IO ()
post d = mapM_ print $ V.toList d

solve :: Data -> Counter 
solve stones = go 0 counter stones  where
  counter :: Counter 
  counter = V.fromListN (V.length stones) $ repeat 0

  go :: Int -> Counter -> Data -> Counter
  go i counter stones =
    if  0 == fst min then
      counter'
    else if 1 == (fst $ V.head stones) then
      counter'
    else
      go i' counter' stones'
    where
      s@((minI,min), (maxI,max), less, maxStones) = takeStones 0 stones

      i' = i + 1

      counter' :: Counter
      counter' = counter V.// [(snd min-1, (counter V.! (snd min - 1)) + V.length maxStones)]

      stones' :: Data
      stones' = V.update stones 
        $ V.map (\(i,(si,sn)) -> (i, (si - (si - fst less), sn))) 
        $ maxStones


takeStones :: Int -> Data 
  -> ((Int,(Int,Int)),(Int,(Int,Int)),(Int,Int),V.Vector (Int,(Int,Int)))
takeStones i d = go i (0,0) 0 (0,0) 0 (0,0) V.empty where
  go i min minI max maxI less v = 
    case d V.!? i of
      Nothing -> ((minI, min), (maxI, max), less, v)
      Just s@(si,sn) ->
        if fst min < si then
          go (i + 1) s i s i s (V.cons (i,s) v)
        else
          if fst min == si then
            if snd min < sn then
              if snd max < sn then
                go (i + 1) min minI s i s (V.cons (i,s) v)
              else
                go (i + 1) min minI max maxI s (V.cons (i,s) v)
            else
              if snd max < sn then
                go (i + 1) s i s i s (V.cons (i,s) v)
              else
                go (i + 1) s i max maxI s (V.cons (i,s) v)
          else
            ((minI,min), (maxI,max), s, v)


main = post =<< (solve <$> get)
