open Printf
open Scanf

let id x = x

let n = scanf "%d" id
let vs = Array.init n (fun i -> scanf " %d" id)

let calc first =
  let flg = ref first in
  let sum = ref 0 in
  let count = ref 0 in
  for i = 0 to Array.length vs - 1 do
    sum := !sum + vs.(i);
    if !flg then begin
      if !sum <= 0 then begin
        let diff = abs (1 - !sum) in
        count := !count + diff;
        sum := 1
      end else
        ()
    end else begin
      if !sum >= 0 then begin
        let diff = abs (~-1 - !sum) in
        count := !count + diff;
        sum := ~-1
      end else
        ()
    end;
    flg := not !flg
  done;
  !count

let () =
  let start_pos = calc true in
  let start_neg = calc false in
  printf "%d\n" (min start_pos start_neg)
