'use strict'
let input = require("fs").readFileSync("/dev/stdin", "utf8");
let Nums = input.split('\n');
let amount = Nums[0]*1;
let arr = Nums[1].split(" ").map(x => x*1);
let isPrus = arr[0] > 0? true: false;
let sum = 0;
let ans = 0;
for(let i = 0; i < amount; i++){
	//console.log(arr[i])
  	//console.log(isPrus)
  	sum += arr[i];
  	if(sum > 0 != isPrus){
      	ans += Math.abs(sum);
      	sum = 0;
    }
  	// 足し合わせが0になった時も合わせて処理
  	if(sum == 0){
    	if(isPrus){
        	sum = 1;
          	ans += 1;
        } else {
            sum = -1;
          	ans += 1;
        }
    }  
  	isPrus = !isPrus;
}

console.log(ans);
