import Control.Applicative
import Data.List

main = do
  _ <- getLine
  as <- (map read) . words <$> getLine

  print $ minimum
    [sum $ zipWith (\a b -> abs (a-b)) (f 0 as True) as,
     sum $ zipWith (\a b -> abs (a-b)) (f 0 as False) as]
     
  where
    f _ [] _ = []
    f ps (x:xs) m =
      if ps * (ps+x) < 0 then
        x : (f (ps+x) xs m)
      else
        if ps > 0 then
          (-ps-1) : (f (-1) xs m)
        else if ps < 0 then
          (-ps+1) : (f 1 xs m)
        else
          if x /= 0 then
            x : (f x xs m)
          else
            if m then
              1 : (f 1 xs m)
            else
              (-1) : (f (-1) xs m)
            
