import itertools

n = int(eval(input()))

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

sum = list(itertools.accumulate(a))

#'+-+-...'と'-+-+...'でそれぞれ求める

res1 = 0

res2 = 0

dif1 = 0

dif2 = 0

for i in range(n):

    s = sum[i] + dif1

    t = sum[i] + dif2

    if i%2==0:

        if s<1:

            dif1 += 1 - s

            res1 += 1 - s

        if t>-1:

            dif2 -= 1 + t

            res2 += 1 + t

    else:

        if s>-1:

            dif1 -= 1 + s

            res1 += 1 + s

        if t<1:

            dif2 += 1 - t

            res2 += 1 - t

    #print(dif1,res1,dif2,res2)

print((min(res1,res2)))

#print(res1,res2)

import itertools

n = int(eval(input()))

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

#'+-+-...'と'-+-+...'でそれぞれ求める

res1 = 0

res2 = 0

dif1 = 0

dif2 = 0

for i,j in enumerate(itertools.accumulate(a)):

    s = j + dif1

    t = j + dif2

    if i%2==0:

        if s<1:

            dif1 += 1 - s

            res1 += 1 - s

        if t>-1:

            dif2 -= 1 + t

            res2 += 1 + t

    else:

        if s>-1:

            dif1 -= 1 + s

            res1 += 1 + s

        if t<1:

            dif2 += 1 - t

            res2 += 1 - t

print((min(res1,res2)))

import itertools

n = int(eval(input()))
a = list(map(int, input().split()))
sum = list(itertools.accumulate(a))
#'+-+-...'と'-+-+...'でそれぞれ求める
res1 = 0
res2 = 0
dif1 = 0
dif2 = 0
for i in range(n):
    s = sum[i] + dif1
    t = sum[i] + dif2
    if i % 2 == 0:
        if s < 1:
            dif1 += 1 - s
            res1 += 1 - s
        if t > -1:
            dif2 -= 1 + t
            res2 += 1 + t
    else:
        if s > -1:
            dif1 -= 1 + s
            res1 += 1 + s
        if t < 1:
            dif2 += 1 - t
            res2 += 1 - t
    # print(dif1,res1,dif2,res2)
print((min(res1, res2)))
# print(res1,res2)

import itertools

n = int(eval(input()))
a = list(map(int, input().split()))
#'+-+-...'と'-+-+...'でそれぞれ求める
res1 = 0
res2 = 0
dif1 = 0
dif2 = 0
for i, j in enumerate(itertools.accumulate(a)):
    s = j + dif1
    t = j + dif2
    if i % 2 == 0:
        if s < 1:
            dif1 += 1 - s
            res1 += 1 - s
        if t > -1:
            dif2 -= 1 + t
            res2 += 1 + t
    else:
        if s > -1:
            dif1 -= 1 + s
            res1 += 1 + s
        if t < 1:
            dif2 += 1 - t
            res2 += 1 - t
print((min(res1, res2)))

-sum = list(itertools.accumulate(a)) -for i in range(n): -    s = sum[i] + dif1 -    t = sum[i] + dif2 +for i, j in enumerate(itertools.accumulate(a)): +    s = j + dif1 +    t = j + dif2 -    # print(dif1,res1,dif2,res2) -# print(res1,res2)