solve [] v acc = acc
solve as v acc
  | v < 0 =
    let w = v + (head as) in
      if w <= 0
        then solve (tail as) 1 (1 - w + acc)
        else solve (tail as) w acc
  | v > 0 =
    let w = v + (head as) in
      if w >= 0
        then solve (tail as) (-1) (1 + w + acc)
        else solve (tail as) w acc

-- a0は0ではないとした
main = do
  n <- read <$> getLine :: IO Int
  l <- getLine
  let as = fmap read (words l) :: [Int] in
    putStrLn (show (solve (tail as) (head as) 0))
