f x [] = 0
f x (a:as)
  | x<0&&(-x)<a || x>0&&(-x)>a = f (x+a) as
  | otherwise = abs (x+a)+1 + f (signum (-x)) as
main = do
  getLine
  (a:as) <- map read . words <$> getLine
  print $ if a == 0
    then f 1 as `min` f (-1) as + 1
    else f a as `min` f (-a) as