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

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

bool isSameSign(int a, int b) {
    if (a == 0 && b == 0) return true;
    if ((a > 0 && b > 0) || (a < 0 && b < 0)) return true;
    return false;
}

long calc(int[] a) {

    long _calc(int sign) {
        int ans = 0;
        int s = sign;
        int sum = 0;
        foreach (x; a) {
            sum += x;
//            writeln("sum ", sum, " s ", s);
            if (!isSameSign(sum, s)) {
                int y = sum * -1 + s;
                x = y;
//                writeln("y = ", y);
                ans += abs(x);
                sum += y;
            }
            s *= -1;
        }
//        writeln(">>> ", ans);
        return ans;
    }

    return min(_calc(1), _calc(-1));
}

void main() {
    readint;
    auto a = readints;
    writeln(calc(a));
}
