n = int(eval(input()))

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

b = [a_ for a_ in a]

 

ans = 10**14

for a0 in [-1,a[0],1]:

    if a0 == 0:

        continue

    ans_ = abs(a[0]-a0)

    b[0] = a0

    sign = b[0] > 0

    for i in range(1,n):

        b[i] = a[i]+b[i-1]

        if sign:

            if b[i] >= 0:

                ans_ += b[i]+1

                b[i] = -1

        else:

            if b[i] <= 0:

                ans_ += 1-b[i]

                b[i] = 1

        sign = not sign

    ans = min(ans, ans_)

print(ans)
n = int(eval(input()))

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

 

def adj(n, a ,flag):

    na = 0

    cnt = 0

    for i in range(n):

        na += a[i]

        if flag == 1:

            if na <= 0:

                cnt += 1 - na

                na = 1

            flag = -1

        

        elif flag == -1:

            if na >= 0:

                cnt += na + 1

                na = -1

            flag = 1

    return cnt            



print((min(adj(n, A, 1),adj(n, A, -1))))
n = int(eval(input()))
a = list(map(int, input().split()))
b = [a_ for a_ in a]
ans = 10**14
for a0 in [-1, a[0], 1]:
    if a0 == 0:
        continue
    ans_ = abs(a[0] - a0)
    b[0] = a0
    sign = b[0] > 0
    for i in range(1, n):
        b[i] = a[i] + b[i - 1]
        if sign:
            if b[i] >= 0:
                ans_ += b[i] + 1
                b[i] = -1
        else:
            if b[i] <= 0:
                ans_ += 1 - b[i]
                b[i] = 1
        sign = not sign
    ans = min(ans, ans_)
print(ans)

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


def adj(n, a, flag):
    na = 0
    cnt = 0
    for i in range(n):
        na += a[i]
        if flag == 1:
            if na <= 0:
                cnt += 1 - na
                na = 1
            flag = -1
        elif flag == -1:
            if na >= 0:
                cnt += na + 1
                na = -1
            flag = 1
    return cnt


print((min(adj(n, A, 1), adj(n, A, -1))))

-a = list(map(int, input().split())) -b = [a_ for a_ in a] -ans = 10**14 -for a0 in [-1, a[0], 1]: -    if a0 == 0: -        continue -    ans_ = abs(a[0] - a0) -    b[0] = a0 -    sign = b[0] > 0 -    for i in range(1, n): -        b[i] = a[i] + b[i - 1] -        if sign: -            if b[i] >= 0: -                ans_ += b[i] + 1 -                b[i] = -1 -        else: -            if b[i] <= 0: -                ans_ += 1 - b[i] -                b[i] = 1 -        sign = not sign -    ans = min(ans, ans_) -print(ans) +A = list(map(int, input().split())) + + +def adj(n, a, flag): +    na = 0 +    cnt = 0 +    for i in range(n): +        na += a[i] +        if flag == 1: +            if na <= 0: +                cnt += 1 - na +                na = 1 +            flag = -1 +        elif flag == -1: +            if na >= 0: +                cnt += na + 1 +                na = -1 +            flag = 1 +    return cnt + + +print((min(adj(n, A, 1), adj(n, A, -1))))