from itertools import accumulate

n, *A = list(map(int, open(0).read().split()))

B = list(accumulate(A))

p0 = n0 = p1 = n1 = 0

for i, b in enumerate(B):

    if i % 2 == 0:

        if b+p0-n0 <= 0:

            p0 += abs(b+p0-n0)+1

        if b+p1-n1 >= 0:

            n1 += abs(b+p1-n1)+1

    else:

        if b+p0-n0 >= 0:

            n0 += abs(b+p0-n0)+1

        if b+p1-n1 <= 0:

            p1 += abs(b+p1-n1)+1

print((min(p0+n0, p1+n1)))

n = int(eval(input()))

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



def calc(t):

  ans = su = 0

  for i in range(n):

    su += a[i]

    if i % 2 == t:

      if su > 0:

        pass

      else:

        x = 1 - su

        ans += abs(x)

        su = 1

    else:

      if su < 0:

        pass

      else:

        x = - 1 - su

        ans += abs(x)

        su = -1

  return ans

print((min(calc(1), calc(0))))
from itertools import accumulate

n, *A = list(map(int, open(0).read().split()))
B = list(accumulate(A))
p0 = n0 = p1 = n1 = 0
for i, b in enumerate(B):
    if i % 2 == 0:
        if b + p0 - n0 <= 0:
            p0 += abs(b + p0 - n0) + 1
        if b + p1 - n1 >= 0:
            n1 += abs(b + p1 - n1) + 1
    else:
        if b + p0 - n0 >= 0:
            n0 += abs(b + p0 - n0) + 1
        if b + p1 - n1 <= 0:
            p1 += abs(b + p1 - n1) + 1
print((min(p0 + n0, p1 + n1)))

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


def calc(t):
    ans = su = 0
    for i in range(n):
        su += a[i]
        if i % 2 == t:
            if su > 0:
                pass
            else:
                x = 1 - su
                ans += abs(x)
                su = 1
        else:
            if su < 0:
                pass
            else:
                x = -1 - su
                ans += abs(x)
                su = -1
    return ans


print((min(calc(1), calc(0))))

-from itertools import accumulate +n = int(eval(input())) +a = list(map(int, input().split())) -n, *A = list(map(int, open(0).read().split())) -B = list(accumulate(A)) -p0 = n0 = p1 = n1 = 0 -for i, b in enumerate(B): -    if i % 2 == 0: -        if b + p0 - n0 <= 0: -            p0 += abs(b + p0 - n0) + 1 -        if b + p1 - n1 >= 0: -            n1 += abs(b + p1 - n1) + 1 -    else: -        if b + p0 - n0 >= 0: -            n0 += abs(b + p0 - n0) + 1 -        if b + p1 - n1 <= 0: -            p1 += abs(b + p1 - n1) + 1 -print((min(p0 + n0, p1 + n1))) + +def calc(t): +    ans = su = 0 +    for i in range(n): +        su += a[i] +        if i % 2 == t: +            if su > 0: +                pass +            else: +                x = 1 - su +                ans += abs(x) +                su = 1 +        else: +            if su < 0: +                pass +            else: +                x = -1 - su +                ans += abs(x) +                su = -1 +    return ans + + +print((min(calc(1), calc(0))))