function Main(s) {
  var s = s.split("\n");
  var n = parseInt(s[0], 10);
  var a = s[1].split(" ").map(e => parseInt(e, 10));
  var acc1 = 0, cnt1 = 0, arr1 = [];
  var acc2 = 0, cnt2 = 0, arr2 = [];
  for (var i = 0; i < n; i++) {
    acc1 += a[i];
    if (i != 0) {
      if (arr1[i - 1] > 0) {
        if (acc1 >= 0) {
          cnt1 += (acc1 + 1);
          acc1 -= (acc1 + 1);
        }
      } else {
        if (acc1 <= 0) {
          cnt1 += (Math.abs(acc1) + 1);
          acc1 += (Math.abs(acc1) + 1);
        }
      }
    }
    arr1.push(acc1);
  }
  console.log(cnt1);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));