n = int(eval(input()))

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



count1 = 0

accum1 = 0

for i in range(n):

    if i % 2 == 0:

        if accum1 + A[i] <= 0:

            count1 += 1 - accum1 - A[i]

            accum1 = 1

        else:

            accum1 += A[i]

    else:

        if accum1 + A[i] >= 0:

            count1 += 1 + accum1 + A[i]

            accum1 = -1

        else:

            accum1 += A[i]

            

count2 = 0

accum2 = 0

for i in range(n):

    if i % 2 != 0:

        if accum2 + A[i] <= 0:

            count2 += 1 - accum2 - A[i]

            accum2 = 1

        else:

            accum2 += A[i]

    else:

        if accum2 + A[i] >= 0:

            count2 += 1 + accum2 + A[i]

            accum2 = -1

        else:

            accum2 += A[i]

            

print((min(count1,count2)))
N = int(eval(input()))

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



res1 = 0

cum1 = 0



for i in range(N):

    cum1 += A[i]

    if i % 2 == 0 and cum1 <= 0:

        res1 += - cum1 + 1

        cum1 = 1

    if i % 2 != 0 and cum1 >= 0:

        res1 += cum1 + 1

        cum1 = -1



res2 = 0

cum2 = 0



for i in range(N):

    cum2 += A[i]

    if i % 2 != 0 and cum2 <= 0:

        res2 += - cum2 + 1

        cum2 = 1

    if i % 2 == 0 and cum2 >= 0:

        res2 += cum2 + 1

        cum2 = -1



print((min(res1, res2)))
n = int(eval(input()))
A = list(map(int, input().split()))
count1 = 0
accum1 = 0
for i in range(n):
    if i % 2 == 0:
        if accum1 + A[i] <= 0:
            count1 += 1 - accum1 - A[i]
            accum1 = 1
        else:
            accum1 += A[i]
    else:
        if accum1 + A[i] >= 0:
            count1 += 1 + accum1 + A[i]
            accum1 = -1
        else:
            accum1 += A[i]
count2 = 0
accum2 = 0
for i in range(n):
    if i % 2 != 0:
        if accum2 + A[i] <= 0:
            count2 += 1 - accum2 - A[i]
            accum2 = 1
        else:
            accum2 += A[i]
    else:
        if accum2 + A[i] >= 0:
            count2 += 1 + accum2 + A[i]
            accum2 = -1
        else:
            accum2 += A[i]
print((min(count1, count2)))

N = int(eval(input()))
A = list(map(int, input().split()))
res1 = 0
cum1 = 0
for i in range(N):
    cum1 += A[i]
    if i % 2 == 0 and cum1 <= 0:
        res1 += -cum1 + 1
        cum1 = 1
    if i % 2 != 0 and cum1 >= 0:
        res1 += cum1 + 1
        cum1 = -1
res2 = 0
cum2 = 0
for i in range(N):
    cum2 += A[i]
    if i % 2 != 0 and cum2 <= 0:
        res2 += -cum2 + 1
        cum2 = 1
    if i % 2 == 0 and cum2 >= 0:
        res2 += cum2 + 1
        cum2 = -1
print((min(res1, res2)))

-n = int(eval(input())) +N = int(eval(input())) -count1 = 0 -accum1 = 0 -for i in range(n): -    if i % 2 == 0: -        if accum1 + A[i] <= 0: -            count1 += 1 - accum1 - A[i] -            accum1 = 1 -        else: -            accum1 += A[i] -    else: -        if accum1 + A[i] >= 0: -            count1 += 1 + accum1 + A[i] -            accum1 = -1 -        else: -            accum1 += A[i] -count2 = 0 -accum2 = 0 -for i in range(n): -    if i % 2 != 0: -        if accum2 + A[i] <= 0: -            count2 += 1 - accum2 - A[i] -            accum2 = 1 -        else: -            accum2 += A[i] -    else: -        if accum2 + A[i] >= 0: -            count2 += 1 + accum2 + A[i] -            accum2 = -1 -        else: -            accum2 += A[i] -print((min(count1, count2))) +res1 = 0 +cum1 = 0 +for i in range(N): +    cum1 += A[i] +    if i % 2 == 0 and cum1 <= 0: +        res1 += -cum1 + 1 +        cum1 = 1 +    if i % 2 != 0 and cum1 >= 0: +        res1 += cum1 + 1 +        cum1 = -1 +res2 = 0 +cum2 = 0 +for i in range(N): +    cum2 += A[i] +    if i % 2 != 0 and cum2 <= 0: +        res2 += -cum2 + 1 +        cum2 = 1 +    if i % 2 == 0 and cum2 >= 0: +        res2 += cum2 + 1 +        cum2 = -1 +print((min(res1, res2)))