n = int(eval(input()))

A = list(map(int,input().split()))

B = A[:]

for i in range(1,n):

    B[i] += B[i-1]

C = B[:]

cnt1 = 0

cnt2 = 0

if B[0]<=0:

    cnt1 += abs(1-B[0])

    cnt2 += 1-B[0]

    B[0] += cnt2

for i in range(1,n):

    if i%2==0:

        if B[i]+cnt2<=0:

            cnt1 += abs(1-B[i]-cnt2)

            cnt2 += 1-B[i]-cnt2

            B[i] += cnt2

    else:

        if B[i]+cnt2>=0:

            cnt1 += abs(-1-B[i]-cnt2)

            cnt2 += -1-B[i]-cnt2

            B[i] += cnt2

cnt3 = 0

cnt4 = 0

if C[0]>=0:

    cnt3 += abs(-1-C[0])

    cnt4 += -1-C[0]

    C[0] += cnt4

for i in range(1,n):

    if i%2==0:

        if C[i]+cnt4>=0:

            cnt3 += abs(-1-C[i]-cnt4)

            cnt4 += -1-C[i]-cnt4

            C[i] += cnt4

    else:

        if C[i]+cnt4<=0:

            cnt3 += abs(1-C[i]-cnt4)

            cnt4 += 1-C[i]-cnt4

            C[i] += cnt4

print((min(cnt1,cnt3)))
n = int(eval(input()))

A = list(map(int,input().split()))

B = A[:]

cntp = 0

totp = 0

for i in range(n):

    if i%2==0:

        if B[i]>=1-totp:

            totp += B[i]

        else:

            cntp += 1-totp-B[i]

            totp = 1

    else:

        if B[i]<=-1-totp:

            totp += B[i]

        else:

            cntp += B[i]+1+totp

            totp = -1

cntm = 0

totm = 0

for i in range(n):

    if i%2==0:

        if B[i]<=-1-totm:

            totm += B[i]

        else:

            cntm += B[i]+1+totm

            totm = -1

    else:

        if B[i]>=1-totm:

            totm += B[i]

        else:

            cntm += 1-totm-B[i]

            totm = 1

print((min(cntp,cntm)))
n = int(eval(input()))
A = list(map(int, input().split()))
B = A[:]
for i in range(1, n):
    B[i] += B[i - 1]
C = B[:]
cnt1 = 0
cnt2 = 0
if B[0] <= 0:
    cnt1 += abs(1 - B[0])
    cnt2 += 1 - B[0]
    B[0] += cnt2
for i in range(1, n):
    if i % 2 == 0:
        if B[i] + cnt2 <= 0:
            cnt1 += abs(1 - B[i] - cnt2)
            cnt2 += 1 - B[i] - cnt2
            B[i] += cnt2
    else:
        if B[i] + cnt2 >= 0:
            cnt1 += abs(-1 - B[i] - cnt2)
            cnt2 += -1 - B[i] - cnt2
            B[i] += cnt2
cnt3 = 0
cnt4 = 0
if C[0] >= 0:
    cnt3 += abs(-1 - C[0])
    cnt4 += -1 - C[0]
    C[0] += cnt4
for i in range(1, n):
    if i % 2 == 0:
        if C[i] + cnt4 >= 0:
            cnt3 += abs(-1 - C[i] - cnt4)
            cnt4 += -1 - C[i] - cnt4
            C[i] += cnt4
    else:
        if C[i] + cnt4 <= 0:
            cnt3 += abs(1 - C[i] - cnt4)
            cnt4 += 1 - C[i] - cnt4
            C[i] += cnt4
print((min(cnt1, cnt3)))

n = int(eval(input()))
A = list(map(int, input().split()))
B = A[:]
cntp = 0
totp = 0
for i in range(n):
    if i % 2 == 0:
        if B[i] >= 1 - totp:
            totp += B[i]
        else:
            cntp += 1 - totp - B[i]
            totp = 1
    else:
        if B[i] <= -1 - totp:
            totp += B[i]
        else:
            cntp += B[i] + 1 + totp
            totp = -1
cntm = 0
totm = 0
for i in range(n):
    if i % 2 == 0:
        if B[i] <= -1 - totm:
            totm += B[i]
        else:
            cntm += B[i] + 1 + totm
            totm = -1
    else:
        if B[i] >= 1 - totm:
            totm += B[i]
        else:
            cntm += 1 - totm - B[i]
            totm = 1
print((min(cntp, cntm)))

-for i in range(1, n): -    B[i] += B[i - 1] -C = B[:] -cnt1 = 0 -cnt2 = 0 -if B[0] <= 0: -    cnt1 += abs(1 - B[0]) -    cnt2 += 1 - B[0] -    B[0] += cnt2 -for i in range(1, n): +cntp = 0 +totp = 0 +for i in range(n): -        if B[i] + cnt2 <= 0: -            cnt1 += abs(1 - B[i] - cnt2) -            cnt2 += 1 - B[i] - cnt2 -            B[i] += cnt2 +        if B[i] >= 1 - totp: +            totp += B[i] +        else: +            cntp += 1 - totp - B[i] +            totp = 1 -        if B[i] + cnt2 >= 0: -            cnt1 += abs(-1 - B[i] - cnt2) -            cnt2 += -1 - B[i] - cnt2 -            B[i] += cnt2 -cnt3 = 0 -cnt4 = 0 -if C[0] >= 0: -    cnt3 += abs(-1 - C[0]) -    cnt4 += -1 - C[0] -    C[0] += cnt4 -for i in range(1, n): +        if B[i] <= -1 - totp: +            totp += B[i] +        else: +            cntp += B[i] + 1 + totp +            totp = -1 +cntm = 0 +totm = 0 +for i in range(n): -        if C[i] + cnt4 >= 0: -            cnt3 += abs(-1 - C[i] - cnt4) -            cnt4 += -1 - C[i] - cnt4 -            C[i] += cnt4 +        if B[i] <= -1 - totm: +            totm += B[i] +        else: +            cntm += B[i] + 1 + totm +            totm = -1 -        if C[i] + cnt4 <= 0: -            cnt3 += abs(1 - C[i] - cnt4) -            cnt4 += 1 - C[i] - cnt4 -            C[i] += cnt4 -print((min(cnt1, cnt3))) +        if B[i] >= 1 - totm: +            totm += B[i] +        else: +            cntm += 1 - totm - B[i] +            totm = 1 +print((min(cntp, cntm)))