import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)

main = do
  n <- readLn :: IO Int
  (a:as) <- getIntListBC
  print $ solve a as

bsToInt :: BC.ByteString -> Int
bsToInt = fst . fromJust . BC.readInt

getIntListBC :: IO [Int]
getIntListBC = map bsToInt . BC.words <$> BC.getLine

solve :: Int -> [Int] -> Int
solve _ []    = 0
solve s (a:as)
  | s > 0     = let n = negate $ s + 1
                in if n > a then solve (s + a) as
                            else (abs $ a - n) + solve (s + n) as
  | otherwise = let n = negate $ s - 1
                in if n < a then solve (s + a) as
                            else (abs $ n - a) + solve (s + n) as
