n = int(eval(input()))

A = [int(i) for i in input().split()]



ans = 0

cnt = 0

for i in range(n):

    if i % 2 == 0:

        if cnt + A[i] < 0:

            cnt += A[i]

        else:

            ans += abs(cnt + A[i] - (-1))

            cnt = -1

    else:

        if cnt + A[i] > 0:

            cnt += A[i]

        else:

            ans += abs(cnt + A[i] - 1)

            cnt = 1

            

ans2 = 0

cnt2 = 0

for i in range(n):

    if i % 2 == 1:

        if cnt2 + A[i] < 0:

            cnt2 += A[i]

        else:

            ans2 += abs(cnt2 + A[i] - (-1))

            cnt2 = -1

    else:

        if cnt2 + A[i] > 0:

            cnt2 += A[i]

        else:

            ans2 += abs(cnt2 + A[i] - 1)

            cnt2 = 1

                

print((min(ans, ans2)))
n = int(eval(input()))

A = [int(i) for i in input().split()]



def f(x):

    ans = 0

    cnt = 0

    for i in range(n):

        if i % 2 == x:

            if cnt + A[i] < 0:

                cnt += A[i]

            else:

                ans += abs(cnt + A[i] - (-1))

                cnt = -1

        else:

            if cnt + A[i] > 0:

                cnt += A[i]

            else:

                ans += abs(cnt + A[i] - 1)

                cnt = 1

    return ans



print((min(f(0), f(1))))
n = int(eval(input()))
A = [int(i) for i in input().split()]
ans = 0
cnt = 0
for i in range(n):
    if i % 2 == 0:
        if cnt + A[i] < 0:
            cnt += A[i]
        else:
            ans += abs(cnt + A[i] - (-1))
            cnt = -1
    else:
        if cnt + A[i] > 0:
            cnt += A[i]
        else:
            ans += abs(cnt + A[i] - 1)
            cnt = 1
ans2 = 0
cnt2 = 0
for i in range(n):
    if i % 2 == 1:
        if cnt2 + A[i] < 0:
            cnt2 += A[i]
        else:
            ans2 += abs(cnt2 + A[i] - (-1))
            cnt2 = -1
    else:
        if cnt2 + A[i] > 0:
            cnt2 += A[i]
        else:
            ans2 += abs(cnt2 + A[i] - 1)
            cnt2 = 1
print((min(ans, ans2)))

n = int(eval(input()))
A = [int(i) for i in input().split()]


def f(x):
    ans = 0
    cnt = 0
    for i in range(n):
        if i % 2 == x:
            if cnt + A[i] < 0:
                cnt += A[i]
            else:
                ans += abs(cnt + A[i] - (-1))
                cnt = -1
        else:
            if cnt + A[i] > 0:
                cnt += A[i]
            else:
                ans += abs(cnt + A[i] - 1)
                cnt = 1
    return ans


print((min(f(0), f(1))))

-ans = 0 -cnt = 0 -for i in range(n): -    if i % 2 == 0: -        if cnt + A[i] < 0: -            cnt += A[i] + + +def f(x): +    ans = 0 +    cnt = 0 +    for i in range(n): +        if i % 2 == x: +            if cnt + A[i] < 0: +                cnt += A[i] +            else: +                ans += abs(cnt + A[i] - (-1)) +                cnt = -1 -            ans += abs(cnt + A[i] - (-1)) -            cnt = -1 -    else: -        if cnt + A[i] > 0: -            cnt += A[i] -        else: -            ans += abs(cnt + A[i] - 1) -            cnt = 1 -ans2 = 0 -cnt2 = 0 -for i in range(n): -    if i % 2 == 1: -        if cnt2 + A[i] < 0: -            cnt2 += A[i] -        else: -            ans2 += abs(cnt2 + A[i] - (-1)) -            cnt2 = -1 -    else: -        if cnt2 + A[i] > 0: -            cnt2 += A[i] -        else: -            ans2 += abs(cnt2 + A[i] - 1) -            cnt2 = 1 -print((min(ans, ans2))) +            if cnt + A[i] > 0: +                cnt += A[i] +            else: +                ans += abs(cnt + A[i] - 1) +                cnt = 1 +    return ans + + +print((min(f(0), f(1))))