let () =
  Array.init (Scanf.scanf "%d\n" (fun n -> n)) (fun _ -> Scanf.scanf "%d " (fun a -> a))
  |> Array.to_list
  |> List.fold_left
      (fun (pos_sum, pos_ops, neg_sum, neg_ops) a ->
        (max 1 (neg_sum + a), neg_ops + max 0 (1 - neg_sum - a), min (-1) (pos_sum + a), pos_ops + max 0 (1 + pos_sum + a)))
      (0, 0, 0, 0)
  |> (fun (_, pos_ops, _, neg_ops) -> min pos_ops neg_ops)
  |> Printf.printf "%d\n"
