#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll cnt = 1e15;
int main(){
  int n;
  cin >> n;
  int a[n];
  for(int i=0;i<n;i++) cin >> a[i];
  for(int j=0;j<2;j++){
    ll cnt1 = 0,s = 0;
  	for(int i=0;i<n;i++){
    	s += a[i];
    	int k = (1-2*(i%2))*(1-2*j);
    	if(s*k<=0){
          cnt1 += 1-k*s;
          s = k;
        }
     }
    cnt = min(cnt1,cnt);
  }
  cout << cnt << endl;
}
