n = int(eval(input()))

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



minA = 0

sumA = 0

# 奇数項を正としたときの操作回数minA 

for i in range(n):

  sumA += a[i]

  if i%2 == 0:        

    if sumA <= 0:

      minA += abs(sumA)+1

      sumA += abs(sumA)+1

  else:

    if sumA >= 0:

      minA += abs(sumA)+1

      sumA -= abs(sumA)+1

temp = 0

# 偶数項を正としたときの操作回数minB

minB = 0

sumB = 0

for i in range(n):

  sumB += a[i]

  if i%2 != 0:

    if sumB <= 0:

      minB += abs(sumB)+1

      sumB += abs(sumB)+1

  else:

    if sumB >= 0:

      minB += abs(sumB)+1

      sumB -= abs(sumB)+1

print((min(minA, minB)))      
def F(list_A, sign):

  total = 0

  cnt = 0

  for a in list_A:

    total += a

    if sign==True and total < 1:

      cnt += 1- total

      total = 1

    elif sign==False and total > -1:

      cnt += total + 1

      total = -1

    

    sign = not sign

  return cnt



N = int(eval(input()))

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



ans = min(F(A, True), F(A, False))

print(ans)
n = int(eval(input()))
a = list(map(int, input().split()))
minA = 0
sumA = 0
# 奇数項を正としたときの操作回数minA
for i in range(n):
    sumA += a[i]
    if i % 2 == 0:
        if sumA <= 0:
            minA += abs(sumA) + 1
            sumA += abs(sumA) + 1
    else:
        if sumA >= 0:
            minA += abs(sumA) + 1
            sumA -= abs(sumA) + 1
temp = 0
# 偶数項を正としたときの操作回数minB
minB = 0
sumB = 0
for i in range(n):
    sumB += a[i]
    if i % 2 != 0:
        if sumB <= 0:
            minB += abs(sumB) + 1
            sumB += abs(sumB) + 1
    else:
        if sumB >= 0:
            minB += abs(sumB) + 1
            sumB -= abs(sumB) + 1
print((min(minA, minB)))

def F(list_A, sign):
    total = 0
    cnt = 0
    for a in list_A:
        total += a
        if sign == True and total < 1:
            cnt += 1 - total
            total = 1
        elif sign == False and total > -1:
            cnt += total + 1
            total = -1
        sign = not sign
    return cnt


N = int(eval(input()))
A = list(map(int, input().split()))
ans = min(F(A, True), F(A, False))
print(ans)

-n = int(eval(input())) -a = list(map(int, input().split())) -minA = 0 -sumA = 0 -# 奇数項を正としたときの操作回数minA -for i in range(n): -    sumA += a[i] -    if i % 2 == 0: -        if sumA <= 0: -            minA += abs(sumA) + 1 -            sumA += abs(sumA) + 1 -    else: -        if sumA >= 0: -            minA += abs(sumA) + 1 -            sumA -= abs(sumA) + 1 -temp = 0 -# 偶数項を正としたときの操作回数minB -minB = 0 -sumB = 0 -for i in range(n): -    sumB += a[i] -    if i % 2 != 0: -        if sumB <= 0: -            minB += abs(sumB) + 1 -            sumB += abs(sumB) + 1 -    else: -        if sumB >= 0: -            minB += abs(sumB) + 1 -            sumB -= abs(sumB) + 1 -print((min(minA, minB))) +def F(list_A, sign): +    total = 0 +    cnt = 0 +    for a in list_A: +        total += a +        if sign == True and total < 1: +            cnt += 1 - total +            total = 1 +        elif sign == False and total > -1: +            cnt += total + 1 +            total = -1 +        sign = not sign +    return cnt + + +N = int(eval(input())) +A = list(map(int, input().split())) +ans = min(F(A, True), F(A, False)) +print(ans)