#include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }

  int64_t min_ans = INT64_MAX;
  for (int s = -1; s < 2; s += 2) {
    int64_t ans = 0LLU;
    int64_t sum = 0LLU;
    int sign;
    for (int i = 0, sign = s; i < n; ++i, sign *= -1) {
      sum += a[i];
      // cout << i << "| sign: " << sign << " sum: " << sum << "\n";
      if (sum * sign <= 0) {
        ans += abs(sign - sum);
        sum = sign;
      }
    }
    min_ans = min(min_ans, ans);
  }
  cout << min_ans << "\n";
}
