N = int(eval(input()))

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

currentSum = 0

count1 = 0

count2 = 0

count3 = 0

count4 = 0



for i in range(N):

    restSum = currentSum

    currentSum += A[i]

    if currentSum <= 0 and restSum < 0:

        count1 += abs(currentSum) + 1

        currentSum = 1

    elif currentSum >= 0 and restSum > 0:

        count1 += abs(currentSum) + 1

        currentSum = -1

    elif currentSum == 0 and restSum == 0:

        count1 += 1

        currentSum = -1



currentSum = 0

for i in range(N):

    restSum = currentSum

    currentSum += A[i]

    if currentSum <= 0 and restSum < 0:

        count2 += abs(currentSum) + 1

        currentSum = 1

    elif currentSum >= 0 and restSum > 0:

        count2 += abs(currentSum) + 1

        currentSum = -1

    elif currentSum == 0 and restSum == 0:

        count2 += 1

        currentSum = 1



currentSum = 0

for i in range(N):

    restSum = currentSum

    currentSum += A[i]

    if currentSum <= 0 and restSum < 0:

        count3 += abs(currentSum) + 1

        currentSum = 1

    elif currentSum >= 0 and restSum > 0:

        count3 += abs(currentSum) + 1

        currentSum = -1

    elif A[i] <= 0 and restSum == 0:

        count3 += abs(currentSum) + 1

        currentSum = 1

        

currentSum = 0

for i in range(N):

    restSum = currentSum

    currentSum += A[i]

    if currentSum <= 0 and restSum < 0:

        count4 += abs(currentSum) + 1

        currentSum = 1

    elif currentSum >= 0 and restSum > 0:

        count4 += abs(currentSum) + 1

        currentSum = -1

    elif A[i] >= 0 and restSum == 0:

        count4 += abs(currentSum) + 1

        currentSum = -1

        

print((min(count1, count2, count3, count4)))

N = int(eval(input()))

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

currentSum = 0

count3 = 0

count4 = 0



currentSum = 0

for i in range(N):

    restSum = currentSum

    currentSum += A[i]

    if currentSum <= 0 and restSum < 0:

        count3 += abs(currentSum) + 1

        currentSum = 1

    elif currentSum >= 0 and restSum > 0:

        count3 += abs(currentSum) + 1

        currentSum = -1

    elif A[i] <= 0 and restSum == 0:

        count3 += abs(currentSum) + 1

        currentSum = 1

        

currentSum = 0

for i in range(N):

    restSum = currentSum

    currentSum += A[i]

    if currentSum <= 0 and restSum < 0:

        count4 += abs(currentSum) + 1

        currentSum = 1

    elif currentSum >= 0 and restSum > 0:

        count4 += abs(currentSum) + 1

        currentSum = -1

    elif A[i] >= 0 and restSum == 0:

        count4 += abs(currentSum) + 1

        currentSum = -1

        

print((min(count3, count4)))

N = int(eval(input()))
A = list(map(int, input().split()))
currentSum = 0
count1 = 0
count2 = 0
count3 = 0
count4 = 0
for i in range(N):
    restSum = currentSum
    currentSum += A[i]
    if currentSum <= 0 and restSum < 0:
        count1 += abs(currentSum) + 1
        currentSum = 1
    elif currentSum >= 0 and restSum > 0:
        count1 += abs(currentSum) + 1
        currentSum = -1
    elif currentSum == 0 and restSum == 0:
        count1 += 1
        currentSum = -1
currentSum = 0
for i in range(N):
    restSum = currentSum
    currentSum += A[i]
    if currentSum <= 0 and restSum < 0:
        count2 += abs(currentSum) + 1
        currentSum = 1
    elif currentSum >= 0 and restSum > 0:
        count2 += abs(currentSum) + 1
        currentSum = -1
    elif currentSum == 0 and restSum == 0:
        count2 += 1
        currentSum = 1
currentSum = 0
for i in range(N):
    restSum = currentSum
    currentSum += A[i]
    if currentSum <= 0 and restSum < 0:
        count3 += abs(currentSum) + 1
        currentSum = 1
    elif currentSum >= 0 and restSum > 0:
        count3 += abs(currentSum) + 1
        currentSum = -1
    elif A[i] <= 0 and restSum == 0:
        count3 += abs(currentSum) + 1
        currentSum = 1
currentSum = 0
for i in range(N):
    restSum = currentSum
    currentSum += A[i]
    if currentSum <= 0 and restSum < 0:
        count4 += abs(currentSum) + 1
        currentSum = 1
    elif currentSum >= 0 and restSum > 0:
        count4 += abs(currentSum) + 1
        currentSum = -1
    elif A[i] >= 0 and restSum == 0:
        count4 += abs(currentSum) + 1
        currentSum = -1
print((min(count1, count2, count3, count4)))

N = int(eval(input()))
A = list(map(int, input().split()))
currentSum = 0
count3 = 0
count4 = 0
currentSum = 0
for i in range(N):
    restSum = currentSum
    currentSum += A[i]
    if currentSum <= 0 and restSum < 0:
        count3 += abs(currentSum) + 1
        currentSum = 1
    elif currentSum >= 0 and restSum > 0:
        count3 += abs(currentSum) + 1
        currentSum = -1
    elif A[i] <= 0 and restSum == 0:
        count3 += abs(currentSum) + 1
        currentSum = 1
currentSum = 0
for i in range(N):
    restSum = currentSum
    currentSum += A[i]
    if currentSum <= 0 and restSum < 0:
        count4 += abs(currentSum) + 1
        currentSum = 1
    elif currentSum >= 0 and restSum > 0:
        count4 += abs(currentSum) + 1
        currentSum = -1
    elif A[i] >= 0 and restSum == 0:
        count4 += abs(currentSum) + 1
        currentSum = -1
print((min(count3, count4)))

-count1 = 0 -count2 = 0 -for i in range(N): -    restSum = currentSum -    currentSum += A[i] -    if currentSum <= 0 and restSum < 0: -        count1 += abs(currentSum) + 1 -        currentSum = 1 -    elif currentSum >= 0 and restSum > 0: -        count1 += abs(currentSum) + 1 -        currentSum = -1 -    elif currentSum == 0 and restSum == 0: -        count1 += 1 -        currentSum = -1 -currentSum = 0 -for i in range(N): -    restSum = currentSum -    currentSum += A[i] -    if currentSum <= 0 and restSum < 0: -        count2 += abs(currentSum) + 1 -        currentSum = 1 -    elif currentSum >= 0 and restSum > 0: -        count2 += abs(currentSum) + 1 -        currentSum = -1 -    elif currentSum == 0 and restSum == 0: -        count2 += 1 -        currentSum = 1 -print((min(count1, count2, count3, count4))) +print((min(count3, count4)))