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

main = do
  n <- read <$> getLine :: IO Int
  l <- getLine
  let as = fmap read (words l) :: [Int]
      v = head as
      oddV = if v <= 0
               then solve (tail as) 1 (1 - v)
               else solve (tail as) v 0
      evenV = if v < 0
                then solve (tail as) v 0
                else solve (tail as) (-1) (1 + v) in
    putStrLn (show (min oddV evenV))
