open Batteries
let n = Scanf.scanf "%d" (fun x -> x)
let a = List.init n (fun _ -> Scanf.scanf " %d" (fun x -> x))
let rec solve acc sum sign = function
  | [] -> acc
  | (x::xs) ->
      if (sum+x) * sign > 0 then
        solve acc (sum+x) (-sign) xs
      else
        let acc' = acc + abs (sum+x - sign) in
        solve acc' sign (-sign) xs

let () =
  min (solve 0 0 1 a) (solve 0 0 (-1) a)
  |> Printf.printf "%d\n"

