import Data.Bits
import Data.List
import Control.Monad
import qualified Data.Vector.Unboxed as V
import Control.Monad.ST
import Data.Maybe (fromMaybe)
import qualified Data.ByteString.Lazy.Char8 as B
import Debug.Trace

f :: [Int] -> Int
f [] = 0
f (a:as) = a + (g as)

g :: [Int] -> Int
g [] = 0
g (a:as) = (-a) + (f as)


main :: IO ()
main = do
  n <- readLn :: IO Int
  as <- map read.words <$> getLine :: IO [Int]
  forM_ (take ((length (scanl (\x a -> (2*) $ a - (x `div` 2)) (f as) as)) - 1) (scanl (\x a -> (2*) $ a - (x `div` 2)) (f as) as)) $ \x -> putStr (show x) >> putStr " "
  putStrLn ""
