import numpy as np



n = int(eval(input()))

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



sum_start_plus = 0

sum_start_minus = 0

ans_start_plus = 0

ans_start_minus = 0

flag_start_plus = True

flag_start_minus = True



# プラス始まりの場合を計算する

for a in A:

    sum_start_plus += a

    if flag_start_plus:

        flag_start_plus = False

        if np.sign(sum_start_plus) == 1:

            continue

        else:

            ans_start_plus += abs(1 - sum_start_plus)

            sum_start_plus = 1

    else:

        flag_start_plus = True

        if np.sign(sum_start_plus) == -1:

            continue

        else:

            ans_start_plus += abs(-1 - sum_start_plus)

            sum_start_plus = -1



# マイナス始まりの場合を計算する

for a in A:

    sum_start_minus += a

    if flag_start_minus:

        flag_start_minus = False

        if np.sign(sum_start_minus) == -1:

            continue

        else:

            ans_start_minus += abs(-1 - sum_start_minus)

            sum_start_minus = -1

    else:

        flag_start_minus = True

        if np.sign(sum_start_minus) == 1:

            continue

        else:

            ans_start_minus += abs(1 - sum_start_minus)

            sum_start_minus = 1



print((min(ans_start_plus, ans_start_minus)))
n = int(eval(input()))

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

sum_start_plus = 0

sum_start_minus = 0

ans_start_plus = 0

ans_start_minus = 0

flag_start_plus = True

flag_start_minus = True



# プラス始まりの場合を計算する

for a in A:

    sum_start_plus += a

    if flag_start_plus:

        flag_start_plus = False

        if sum_start_plus > 0:

            continue

        else:

            ans_start_plus += abs(1 - sum_start_plus)

            sum_start_plus = 1

    else:

        flag_start_plus = True

        if sum_start_plus < 0:

            continue

        else:

            ans_start_plus += abs(-1 - sum_start_plus)

            sum_start_plus = -1



# マイナス始まりの場合を計算する

for a in A:

    sum_start_minus += a

    if flag_start_minus:

        flag_start_minus = False

        if sum_start_minus < 0:

            continue

        else:

            ans_start_minus += abs(-1 - sum_start_minus)

            sum_start_minus = -1

    else:

        flag_start_minus = True

        if sum_start_minus > 0:

            continue

        else:

            ans_start_minus += abs(1 - sum_start_minus)

            sum_start_minus = 1



print((min(ans_start_plus, ans_start_minus)))
import numpy as np

n = int(eval(input()))
A = [int(x) for x in input().split()]
sum_start_plus = 0
sum_start_minus = 0
ans_start_plus = 0
ans_start_minus = 0
flag_start_plus = True
flag_start_minus = True
# プラス始まりの場合を計算する
for a in A:
    sum_start_plus += a
    if flag_start_plus:
        flag_start_plus = False
        if np.sign(sum_start_plus) == 1:
            continue
        else:
            ans_start_plus += abs(1 - sum_start_plus)
            sum_start_plus = 1
    else:
        flag_start_plus = True
        if np.sign(sum_start_plus) == -1:
            continue
        else:
            ans_start_plus += abs(-1 - sum_start_plus)
            sum_start_plus = -1
# マイナス始まりの場合を計算する
for a in A:
    sum_start_minus += a
    if flag_start_minus:
        flag_start_minus = False
        if np.sign(sum_start_minus) == -1:
            continue
        else:
            ans_start_minus += abs(-1 - sum_start_minus)
            sum_start_minus = -1
    else:
        flag_start_minus = True
        if np.sign(sum_start_minus) == 1:
            continue
        else:
            ans_start_minus += abs(1 - sum_start_minus)
            sum_start_minus = 1
print((min(ans_start_plus, ans_start_minus)))

n = int(eval(input()))
A = [int(x) for x in input().split()]
sum_start_plus = 0
sum_start_minus = 0
ans_start_plus = 0
ans_start_minus = 0
flag_start_plus = True
flag_start_minus = True
# プラス始まりの場合を計算する
for a in A:
    sum_start_plus += a
    if flag_start_plus:
        flag_start_plus = False
        if sum_start_plus > 0:
            continue
        else:
            ans_start_plus += abs(1 - sum_start_plus)
            sum_start_plus = 1
    else:
        flag_start_plus = True
        if sum_start_plus < 0:
            continue
        else:
            ans_start_plus += abs(-1 - sum_start_plus)
            sum_start_plus = -1
# マイナス始まりの場合を計算する
for a in A:
    sum_start_minus += a
    if flag_start_minus:
        flag_start_minus = False
        if sum_start_minus < 0:
            continue
        else:
            ans_start_minus += abs(-1 - sum_start_minus)
            sum_start_minus = -1
    else:
        flag_start_minus = True
        if sum_start_minus > 0:
            continue
        else:
            ans_start_minus += abs(1 - sum_start_minus)
            sum_start_minus = 1
print((min(ans_start_plus, ans_start_minus)))

-import numpy as np - -        if np.sign(sum_start_plus) == 1: +        if sum_start_plus > 0: -        if np.sign(sum_start_plus) == -1: +        if sum_start_plus < 0: -        if np.sign(sum_start_minus) == -1: +        if sum_start_minus < 0: -        if np.sign(sum_start_minus) == 1: +        if sum_start_minus > 0: