import std.stdio;
import std.algorithm;
import std.array;
import std.conv;
import std.string;
import std.math;

void main() {
  int n = readln.chomp.to!int;
  auto a = readln.chomp.split.map!(to!int).array;

  long[] sum_a = new long[](n);
  long ans;

  sum_a[0] = a[0];

  if (a[0] == 0) {
    ans++;
    if (a[1] >= 0) {
      a[0]++;
      sum_a[0]++;
    }
    else {
      a[0]--;
      sum_a[0]--;
    }
  }

  for (int i = 1; i < n; ++i) {
    sum_a[i] = sum_a[i - 1] + a[i];

    if (sum_a[i] > 0 && sum_a[i - 1] < 0 || sum_a[i] < 0 && sum_a[i - 1] > 0) {
      // ok
    }
    else {
      long dif;

      if (sum_a[i - 1] > 0) {
        dif = -1 - sum_a[i];        
      }
      else {
        dif = 1 - sum_a[i];
      }

      a[i] += dif;
      sum_a[i] = sum_a[i - 1] + a[i];
      writeln(sum_a);
      ans += dif.abs;
    }
  }

  ans.writeln;

  return;
}
