from collections import defaultdict





def solve(pre_is_positive, total, ans, a_list):

    for a in a_list:

        total += a

        if pre_is_positive:

            if total == 0:

                ans += 1

                total = -1

            elif total > 0:

                ans += abs(total) + 1

                total = -1

        elif not pre_is_positive:

            if total == 0:

                ans += 1

                total = 1

            elif total < 0:

                ans += abs(total) + 1

                total = 1



        pre_is_positive = total > 0



    return ans





def main():

    n = int(eval(input()))

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



    total = a_list[0]

    if total == 0:

        ans = solve(True, 1, 1, a_list[1:])

        ans = min(ans, solve(False, -1, 1, a_list[1:]))

    elif total > 0:

        ans = solve(True, total, 0, a_list[1:])

        ans = min(ans, solve(False, -1, abs(total) + 1, a_list[1:]))

    else:

        ans = solve(False, total, 0, a_list[1:])

        ans = min(ans, solve(True, 1, abs(total) + 1, a_list[1:]))

    print(ans)





if __name__ == '__main__':

    main()

from collections import defaultdict





def solve(pre_is_positive, a_list):

    total = 0

    ans = 0

    for a in a_list:

        total += a

        if pre_is_positive and total >= 0:

            ans += abs(total) + 1

            total = -1

        elif not pre_is_positive and total <= 0:

            ans += abs(total) + 1

            total = 1

        pre_is_positive = total > 0



    return ans





def main():

    n = int(eval(input()))

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

    print((min(solve(True, a_list), solve(False, a_list))))





if __name__ == '__main__':

    main()

from collections import defaultdict


def solve(pre_is_positive, total, ans, a_list):
    for a in a_list:
        total += a
        if pre_is_positive:
            if total == 0:
                ans += 1
                total = -1
            elif total > 0:
                ans += abs(total) + 1
                total = -1
        elif not pre_is_positive:
            if total == 0:
                ans += 1
                total = 1
            elif total < 0:
                ans += abs(total) + 1
                total = 1
        pre_is_positive = total > 0
    return ans


def main():
    n = int(eval(input()))
    a_list = list(map(int, input().split()))
    total = a_list[0]
    if total == 0:
        ans = solve(True, 1, 1, a_list[1:])
        ans = min(ans, solve(False, -1, 1, a_list[1:]))
    elif total > 0:
        ans = solve(True, total, 0, a_list[1:])
        ans = min(ans, solve(False, -1, abs(total) + 1, a_list[1:]))
    else:
        ans = solve(False, total, 0, a_list[1:])
        ans = min(ans, solve(True, 1, abs(total) + 1, a_list[1:]))
    print(ans)


if __name__ == "__main__":
    main()

from collections import defaultdict


def solve(pre_is_positive, a_list):
    total = 0
    ans = 0
    for a in a_list:
        total += a
        if pre_is_positive and total >= 0:
            ans += abs(total) + 1
            total = -1
        elif not pre_is_positive and total <= 0:
            ans += abs(total) + 1
            total = 1
        pre_is_positive = total > 0
    return ans


def main():
    n = int(eval(input()))
    a_list = list(map(int, input().split()))
    print((min(solve(True, a_list), solve(False, a_list))))


if __name__ == "__main__":
    main()

-def solve(pre_is_positive, total, ans, a_list): +def solve(pre_is_positive, a_list): +    total = 0 +    ans = 0 -        if pre_is_positive: -            if total == 0: -                ans += 1 -                total = -1 -            elif total > 0: -                ans += abs(total) + 1 -                total = -1 -        elif not pre_is_positive: -            if total == 0: -                ans += 1 -                total = 1 -            elif total < 0: -                ans += abs(total) + 1 -                total = 1 +        if pre_is_positive and total >= 0: +            ans += abs(total) + 1 +            total = -1 +        elif not pre_is_positive and total <= 0: +            ans += abs(total) + 1 +            total = 1 -    total = a_list[0] -    if total == 0: -        ans = solve(True, 1, 1, a_list[1:]) -        ans = min(ans, solve(False, -1, 1, a_list[1:])) -    elif total > 0: -        ans = solve(True, total, 0, a_list[1:]) -        ans = min(ans, solve(False, -1, abs(total) + 1, a_list[1:])) -    else: -        ans = solve(False, total, 0, a_list[1:]) -        ans = min(ans, solve(True, 1, abs(total) + 1, a_list[1:])) -    print(ans) +    print((min(solve(True, a_list), solve(False, a_list))))