#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;

const int N = 100010, mod = 1e9 + 7;

int n, a[N];
LL sum, res, ans;

int main()
{
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) scanf("%d", a + i);

    sum = 0;
    for(int i = 1, s = 1; i <= n; i++, s *= -1)
    {
        sum += a[i];
        if(sum * s <= 0) res += abs(sum - s), sum = s;
    }

    sum = 0;
    for(int i = 1, s = -1; i <= n; i++, s *= -1)
    {
        sum += a[i];
        if(sum * s <= 0) ans += abs(sum - s), sum = s;
    }

    printf("%lld\n", min(res, ans));
    return 0;
}
