n = int(eval(input()))

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

sum1 = sum2 = cost1 = cost2 = 0

for i in range(n):

    cur = a[i]

    sum1 += cur

    if (sum1<=0, sum1>=0)[i%2]:

        cost1 += 1+sum1*[-1,1][i%2]

        sum1 = [1,-1][i%2]

    sum2 += cur

    if (sum2>=0, sum2<=0)[i%2]:

        cost2 += 1+sum2*[1,-1][i%2]

        sum2 = [-1,1][i%2]

print((min(cost1, cost2)))
def solve():

    n = int(eval(input()))

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

    sum1 = sum2 = cost1 = cost2 = 0

    for i in range(n):

        cur = a[i]

        sum1 += cur

        if (sum1<=0, sum1>=0)[i%2]:

            cost1 += 1+sum1*[-1,1][i%2]

            sum1 = [1,-1][i%2]

        sum2 += cur

        if (sum2>=0, sum2<=0)[i%2]:

            cost2 += 1+sum2*[1,-1][i%2]

            sum2 = [-1,1][i%2]

    print((min(cost1, cost2)))

if __name__ == '__main__':

    solve()
n = int(eval(input()))
a = list(map(int, input().split()))
sum1 = sum2 = cost1 = cost2 = 0
for i in range(n):
    cur = a[i]
    sum1 += cur
    if (sum1 <= 0, sum1 >= 0)[i % 2]:
        cost1 += 1 + sum1 * [-1, 1][i % 2]
        sum1 = [1, -1][i % 2]
    sum2 += cur
    if (sum2 >= 0, sum2 <= 0)[i % 2]:
        cost2 += 1 + sum2 * [1, -1][i % 2]
        sum2 = [-1, 1][i % 2]
print((min(cost1, cost2)))

def solve():
    n = int(eval(input()))
    a = list(map(int, input().split()))
    sum1 = sum2 = cost1 = cost2 = 0
    for i in range(n):
        cur = a[i]
        sum1 += cur
        if (sum1 <= 0, sum1 >= 0)[i % 2]:
            cost1 += 1 + sum1 * [-1, 1][i % 2]
            sum1 = [1, -1][i % 2]
        sum2 += cur
        if (sum2 >= 0, sum2 <= 0)[i % 2]:
            cost2 += 1 + sum2 * [1, -1][i % 2]
            sum2 = [-1, 1][i % 2]
    print((min(cost1, cost2)))


if __name__ == "__main__":
    solve()

-n = int(eval(input())) -a = list(map(int, input().split())) -sum1 = sum2 = cost1 = cost2 = 0 -for i in range(n): -    cur = a[i] -    sum1 += cur -    if (sum1 <= 0, sum1 >= 0)[i % 2]: -        cost1 += 1 + sum1 * [-1, 1][i % 2] -        sum1 = [1, -1][i % 2] -    sum2 += cur -    if (sum2 >= 0, sum2 <= 0)[i % 2]: -        cost2 += 1 + sum2 * [1, -1][i % 2] -        sum2 = [-1, 1][i % 2] -print((min(cost1, cost2))) +def solve(): +    n = int(eval(input())) +    a = list(map(int, input().split())) +    sum1 = sum2 = cost1 = cost2 = 0 +    for i in range(n): +        cur = a[i] +        sum1 += cur +        if (sum1 <= 0, sum1 >= 0)[i % 2]: +            cost1 += 1 + sum1 * [-1, 1][i % 2] +            sum1 = [1, -1][i % 2] +        sum2 += cur +        if (sum2 >= 0, sum2 <= 0)[i % 2]: +            cost2 += 1 + sum2 * [1, -1][i % 2] +            sum2 = [-1, 1][i % 2] +    print((min(cost1, cost2))) + + +if __name__ == "__main__": +    solve()