n = int(eval(input()))

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



total = 0

count = 0

pos_or_neg = True  # True = +, False = -



for a in a_list:

    total += a

    if pos_or_neg:

        if total <= 0:

            count += -total + 1

            total += -total + 1

        pos_or_neg = False



    else:

        if total >= 0:

            count += total + 1

            total -= total + 1

        pos_or_neg = True



first_count = count

count = 0

total = 0

pos_or_neg = False



for a in a_list:

    total += a

    if pos_or_neg:

        if total <= 0:

            count += -total + 1

            total += -total + 1

        pos_or_neg = False



    else:

        if total >= 0:

            count += total + 1

            total -= total + 1

        pos_or_neg = True



print((min(count, first_count)))
def main():

    n = int(eval(input()))

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



    ans1 = 0

    total = 0

    is_plus = True

    for a in A:

        total += a



        if is_plus:

            if total <= 0:

                ans1 += -total + 1

                total = 1

        else:

            if total >= 0:

                ans1 += total + 1

                total = -1



        is_plus = not is_plus



    ans2 = 0

    total = 0

    is_plus = False

    for a in A:

        total += a



        if is_plus:

            if total <= 0:

                ans2 += -total + 1

                total = 1

        else:

            if total >= 0:

                ans2 += total + 1

                total = -1



        is_plus = not is_plus



    print((min(ans1, ans2)))





if __name__ == "__main__":

    main()

n = int(eval(input()))
a_list = list(map(int, input().split()))
total = 0
count = 0
pos_or_neg = True  # True = +, False = -
for a in a_list:
    total += a
    if pos_or_neg:
        if total <= 0:
            count += -total + 1
            total += -total + 1
        pos_or_neg = False
    else:
        if total >= 0:
            count += total + 1
            total -= total + 1
        pos_or_neg = True
first_count = count
count = 0
total = 0
pos_or_neg = False
for a in a_list:
    total += a
    if pos_or_neg:
        if total <= 0:
            count += -total + 1
            total += -total + 1
        pos_or_neg = False
    else:
        if total >= 0:
            count += total + 1
            total -= total + 1
        pos_or_neg = True
print((min(count, first_count)))

def main():
    n = int(eval(input()))
    A = list(map(int, input().split()))
    ans1 = 0
    total = 0
    is_plus = True
    for a in A:
        total += a
        if is_plus:
            if total <= 0:
                ans1 += -total + 1
                total = 1
        else:
            if total >= 0:
                ans1 += total + 1
                total = -1
        is_plus = not is_plus
    ans2 = 0
    total = 0
    is_plus = False
    for a in A:
        total += a
        if is_plus:
            if total <= 0:
                ans2 += -total + 1
                total = 1
        else:
            if total >= 0:
                ans2 += total + 1
                total = -1
        is_plus = not is_plus
    print((min(ans1, ans2)))


if __name__ == "__main__":
    main()

-n = int(eval(input())) -a_list = list(map(int, input().split())) -total = 0 -count = 0 -pos_or_neg = True  # True = +, False = - -for a in a_list: -    total += a -    if pos_or_neg: -        if total <= 0: -            count += -total + 1 -            total += -total + 1 -        pos_or_neg = False -    else: -        if total >= 0: -            count += total + 1 -            total -= total + 1 -        pos_or_neg = True -first_count = count -count = 0 -total = 0 -pos_or_neg = False -for a in a_list: -    total += a -    if pos_or_neg: -        if total <= 0: -            count += -total + 1 -            total += -total + 1 -        pos_or_neg = False -    else: -        if total >= 0: -            count += total + 1 -            total -= total + 1 -        pos_or_neg = True -print((min(count, first_count))) +def main(): +    n = int(eval(input())) +    A = list(map(int, input().split())) +    ans1 = 0 +    total = 0 +    is_plus = True +    for a in A: +        total += a +        if is_plus: +            if total <= 0: +                ans1 += -total + 1 +                total = 1 +        else: +            if total >= 0: +                ans1 += total + 1 +                total = -1 +        is_plus = not is_plus +    ans2 = 0 +    total = 0 +    is_plus = False +    for a in A: +        total += a +        if is_plus: +            if total <= 0: +                ans2 += -total + 1 +                total = 1 +        else: +            if total >= 0: +                ans2 += total + 1 +                total = -1 +        is_plus = not is_plus +    print((min(ans1, ans2))) + + +if __name__ == "__main__": +    main()