import           Data.Char                      ( isSpace )
import qualified Data.Vector.Unboxed           as V
import qualified Data.ByteString.Char8         as C

main = do
    n <- readLn :: IO Int
    a <- V.unfoldr (C.readInt . C.dropWhile isSpace) <$> C.getLine
    let zeros = V.replicate n 0 :: V.Vector Int
        ones  = V.replicate n 1
        ans   = V.tail $ V.accumulate_ (+) zeros a ones
        jot vec
            | V.null vec = print 0
            | otherwise = do
                print $ V.head vec
                jot $ V.tail vec
    jot ans
