import Control.Monad
import Data.List

main=do
    _<-getLine
    (a:as)<-map read.words<$>getLine::IO[Integer]
    print.sum.snd$ mapAccumL f a as

f a b
    | a*(a+b) < 0 = (a+b,0)
    | a < 0 = (1, 1-(a+b))
    | otherwise = ((-1), 1+(a+b))
