main = do
  getLine
  as <- map read . words <$> getLine :: IO [Int]
  let pns = cycle [1,-1] :: [Int]
  print $ min (solve (zip as pns) 0) (solve (zip as (tail pns)) 0)

solve :: [(Int,Int)] -> Int -> Int
solve [] acc = 0
solve ((a1,b1):xs) acc
  | signum (acc+a1) == b1 = 0 + solve xs (acc+a1)
  | b1 == 1 = (1 - (acc+a1)) + solve xs 1
  | otherwise = abs (-1-(acc+a1)) + solve xs (-1)