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

void main()
{
    auto n = readln.chomp.to!uint;
    auto as = readln.chomp.split(" ").map!(to!long).array;

    long op;
    auto sum = as[0];

    foreach (a; as[1..$]) {
        if (sum < 0) {
            if ((sum + a) <= 0) {
                op += (1 - (sum + a));
                sum = 1;
            } else {
                sum += a;
            }
        } else {
            if ((sum + a) >= 0) {
                op += sum + a + 1;
                sum = -1;
            } else {
                sum += a;
            }
        }
    }
    writeln(op);
}