import qualified Data.ByteString.Char8 as BS
import Control.Monad
import Data.List
import Data.Array.ST
import Data.Array (elems)
import Data.Maybe (fromJust)
import Debug.Trace

data Sign = Plus | Minus


calc :: Sign -> [Int] -> Int -> Int
calc _ [] _ = 0
calc Plus (x:xs) total
    | total + x > 0 = calc Minus xs (total + x)
    | otherwise = steps + (calc Minus xs 1)
    where
        steps = 1 - (total + x)
calc Minus (x:xs) total
    | total + x < 0 = calc Plus xs (total + x)
    | otherwise = steps + (calc Plus xs (-1))
    where
        steps = 1 + (total + x)


solve :: [Int] -> Int
solve arr = minimum([a, b])
    where
        a = calc Plus arr 0
        b = calc Minus arr 0


main :: IO ()
main = do
    _ <- BS.getLine
    a <- map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
    print $ solve a

