import std.stdio, std.conv, std.algorithm, std.range, std.array, std.string, std.uni, std.bigint, std.math;

void main() {
  auto n = readln.chomp.to!uint;
  auto an = readln.split.to!(int[]);
  auto sum = 0;
  auto cnt = 0;
  foreach (a; an) {
    if (sum != 0 && (sum + a) * sum >= 0) {
      auto na = -sum - sgn(sum);
      cnt += abs(na - a);
      a = na;
    }
    sum += a;
  }
  writeln(cnt);
}
