import sys

import itertools



input = sys.stdin.readline





def main():

    N = int(eval(input()))

    A = [int(x) for x in input().split()]





    accu = list(itertools.accumulate(A))



    ans1 = 0

    ruiseki = 0

    for i, x in enumerate(accu):

        if i % 2 == 0:

            if ruiseki + x <= 0:

                ans1 += 1 + abs(ruiseki + x)

                ruiseki += 1 + abs(ruiseki + x)

        else:

            if ruiseki + x >= 0:

                ans1 += 1 + abs(ruiseki + x)

                ruiseki += -1 - abs(ruiseki + x)



    ans2 = 0

    ruiseki = 0

    for i, x in enumerate(accu):

        if i % 2 != 0:

            if ruiseki + x <= 0:

                ans2 += 1 + abs(ruiseki + x)

                ruiseki += 1 + abs(ruiseki + x)

        else:

            if ruiseki + x >= 0:

                ans2 += 1 + abs(ruiseki + x)

                ruiseki += -1 - abs(ruiseki + x)



    print((min(ans1, ans2)))



if __name__ == '__main__':

    main()

N = int(eval(input()))

A = [int(x) for x in input().split()]





# plusスタートにする

ans1 = 0

c = 0

plus = True

for a in A:

    c += a

    if plus:

        if c <= 0:

            ans1 += abs(c) + 1

            c = 1

        plus = False

    else:

        if c >= 0:

            ans1 += abs(c) + 1

            c = -1

        plus = True



# minusスタートにする

ans2 = 0

c = 0

plus = False

for a in A:

    c += a

    if plus:

        if c <= 0:

            ans2 += abs(c) + 1

            c = 1

        plus = False

    else:

        if c >= 0:

            ans2 += abs(c) + 1

            c = -1

        plus = True



print((min(ans1, ans2)))

import sys
import itertools

input = sys.stdin.readline


def main():
    N = int(eval(input()))
    A = [int(x) for x in input().split()]
    accu = list(itertools.accumulate(A))
    ans1 = 0
    ruiseki = 0
    for i, x in enumerate(accu):
        if i % 2 == 0:
            if ruiseki + x <= 0:
                ans1 += 1 + abs(ruiseki + x)
                ruiseki += 1 + abs(ruiseki + x)
        else:
            if ruiseki + x >= 0:
                ans1 += 1 + abs(ruiseki + x)
                ruiseki += -1 - abs(ruiseki + x)
    ans2 = 0
    ruiseki = 0
    for i, x in enumerate(accu):
        if i % 2 != 0:
            if ruiseki + x <= 0:
                ans2 += 1 + abs(ruiseki + x)
                ruiseki += 1 + abs(ruiseki + x)
        else:
            if ruiseki + x >= 0:
                ans2 += 1 + abs(ruiseki + x)
                ruiseki += -1 - abs(ruiseki + x)
    print((min(ans1, ans2)))


if __name__ == "__main__":
    main()

N = int(eval(input()))
A = [int(x) for x in input().split()]
# plusスタートにする
ans1 = 0
c = 0
plus = True
for a in A:
    c += a
    if plus:
        if c <= 0:
            ans1 += abs(c) + 1
            c = 1
        plus = False
    else:
        if c >= 0:
            ans1 += abs(c) + 1
            c = -1
        plus = True
# minusスタートにする
ans2 = 0
c = 0
plus = False
for a in A:
    c += a
    if plus:
        if c <= 0:
            ans2 += abs(c) + 1
            c = 1
        plus = False
    else:
        if c >= 0:
            ans2 += abs(c) + 1
            c = -1
        plus = True
print((min(ans1, ans2)))

-import sys -import itertools - -input = sys.stdin.readline - - -def main(): -    N = int(eval(input())) -    A = [int(x) for x in input().split()] -    accu = list(itertools.accumulate(A)) -    ans1 = 0 -    ruiseki = 0 -    for i, x in enumerate(accu): -        if i % 2 == 0: -            if ruiseki + x <= 0: -                ans1 += 1 + abs(ruiseki + x) -                ruiseki += 1 + abs(ruiseki + x) -        else: -            if ruiseki + x >= 0: -                ans1 += 1 + abs(ruiseki + x) -                ruiseki += -1 - abs(ruiseki + x) -    ans2 = 0 -    ruiseki = 0 -    for i, x in enumerate(accu): -        if i % 2 != 0: -            if ruiseki + x <= 0: -                ans2 += 1 + abs(ruiseki + x) -                ruiseki += 1 + abs(ruiseki + x) -        else: -            if ruiseki + x >= 0: -                ans2 += 1 + abs(ruiseki + x) -                ruiseki += -1 - abs(ruiseki + x) -    print((min(ans1, ans2))) - - -if __name__ == "__main__": -    main() +N = int(eval(input())) +A = [int(x) for x in input().split()] +# plusスタートにする +ans1 = 0 +c = 0 +plus = True +for a in A: +    c += a +    if plus: +        if c <= 0: +            ans1 += abs(c) + 1 +            c = 1 +        plus = False +    else: +        if c >= 0: +            ans1 += abs(c) + 1 +            c = -1 +        plus = True +# minusスタートにする +ans2 = 0 +c = 0 +plus = False +for a in A: +    c += a +    if plus: +        if c <= 0: +            ans2 += abs(c) + 1 +            c = 1 +        plus = False +    else: +        if c >= 0: +            ans2 += abs(c) + 1 +            c = -1 +        plus = True +print((min(ans1, ans2)))