n = int(eval(input()))

a = [int(a) for a in input().split()]



def f(times, prefix_sum):

    for i in range(1, n):

        if prefix_sum < 0:

            if prefix_sum + a[i] > 0:

                prefix_sum += a[i]

            else:

                times += 1 - (prefix_sum + a[i])

                prefix_sum = 1      

        elif prefix_sum > 0:

            if prefix_sum + a[i] < 0:

                prefix_sum += a[i]

            else:

                times += abs(-1 - (prefix_sum + a[i]))

                prefix_sum = -1

    

    return times



if a[0] > 0:

    t1 = 0

    p1 = a[0]

else:

    t1 = 1 - a[0]

    p1 = 1





if a[0] < 0:

    t2 = 0

    p2 = a[0]

else:

    t2 = abs(-1 - a[0])

    p2 = -1

    



print((min(f(t1, p1), f(t2, p2))))
import sys



n, *a = list(map(int, sys.stdin.read().split()))



def main():

    s1 = s2 = c1 = c2 = 0

    for i in range(n):

        s1 += a[i]

        s2 += a[i]

        if i & 1:

            if s1 >= 0:

                c1 += abs(-1 - s1)

                s1 = -1



            if s2 <= 0:

                c2 += 1 - s2

                s2 = 1

        else:

            if s1 <= 0:

                c1 += 1 - s1

                s1 = 1



            if s2 >= 0:

                c2 += abs(-1 - s2)

                s2 = -1

    

    return min(c1, c2)



if __name__ == '__main__':

    ans = main()

    print(ans)
n = int(eval(input()))
a = [int(a) for a in input().split()]


def f(times, prefix_sum):
    for i in range(1, n):
        if prefix_sum < 0:
            if prefix_sum + a[i] > 0:
                prefix_sum += a[i]
            else:
                times += 1 - (prefix_sum + a[i])
                prefix_sum = 1
        elif prefix_sum > 0:
            if prefix_sum + a[i] < 0:
                prefix_sum += a[i]
            else:
                times += abs(-1 - (prefix_sum + a[i]))
                prefix_sum = -1
    return times


if a[0] > 0:
    t1 = 0
    p1 = a[0]
else:
    t1 = 1 - a[0]
    p1 = 1
if a[0] < 0:
    t2 = 0
    p2 = a[0]
else:
    t2 = abs(-1 - a[0])
    p2 = -1
print((min(f(t1, p1), f(t2, p2))))

import sys

n, *a = list(map(int, sys.stdin.read().split()))


def main():
    s1 = s2 = c1 = c2 = 0
    for i in range(n):
        s1 += a[i]
        s2 += a[i]
        if i & 1:
            if s1 >= 0:
                c1 += abs(-1 - s1)
                s1 = -1
            if s2 <= 0:
                c2 += 1 - s2
                s2 = 1
        else:
            if s1 <= 0:
                c1 += 1 - s1
                s1 = 1
            if s2 >= 0:
                c2 += abs(-1 - s2)
                s2 = -1
    return min(c1, c2)


if __name__ == "__main__":
    ans = main()
    print(ans)

-n = int(eval(input())) -a = [int(a) for a in input().split()] +import sys + +n, *a = list(map(int, sys.stdin.read().split())) -def f(times, prefix_sum): -    for i in range(1, n): -        if prefix_sum < 0: -            if prefix_sum + a[i] > 0: -                prefix_sum += a[i] -            else: -                times += 1 - (prefix_sum + a[i]) -                prefix_sum = 1 -        elif prefix_sum > 0: -            if prefix_sum + a[i] < 0: -                prefix_sum += a[i] -            else: -                times += abs(-1 - (prefix_sum + a[i])) -                prefix_sum = -1 -    return times +def main(): +    s1 = s2 = c1 = c2 = 0 +    for i in range(n): +        s1 += a[i] +        s2 += a[i] +        if i & 1: +            if s1 >= 0: +                c1 += abs(-1 - s1) +                s1 = -1 +            if s2 <= 0: +                c2 += 1 - s2 +                s2 = 1 +        else: +            if s1 <= 0: +                c1 += 1 - s1 +                s1 = 1 +            if s2 >= 0: +                c2 += abs(-1 - s2) +                s2 = -1 +    return min(c1, c2) -if a[0] > 0: -    t1 = 0 -    p1 = a[0] -else: -    t1 = 1 - a[0] -    p1 = 1 -if a[0] < 0: -    t2 = 0 -    p2 = a[0] -else: -    t2 = abs(-1 - a[0]) -    p2 = -1 -print((min(f(t1, p1), f(t2, p2)))) +if __name__ == "__main__": +    ans = main() +    print(ans)