import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  solve <$> getl read <*> getl (map read . words) >>= print

solve :: Int -> [Int] -> Int
solve n (a:as) = snd $ foldl f (a,0) as
  where
    f (v,d) x
      | (v+x)*v < 0 = (v+x,d)
      | otherwise = if v > 0 then (-1, d+v+x+1)
                    else (1, d-v-x+1)

getl :: (String -> a) -> IO a
getl f = f <$> getLine
