from functools import lru_cache

n = int(eval(input()))

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





@lru_cache(maxsize=None)

def cost_e():

    res = 0

    sum = 0

    for j, y in enumerate(s, 1):

        tmp = sum + y

        if j & 1 and tmp >= 0:

            sum = -1

            res += abs(tmp) + 1

        elif not j & 1 and tmp <= 0:

            sum = 1

            res += abs(tmp) + 1

        else:

            sum = tmp

    return res





@lru_cache(maxsize=None)

def cost_o():

    res = 0

    sum = 0

    for j, y in enumerate(s, 1):

        tmp = sum + y

        if j & 1 and tmp <= 0:

            sum = 1

            res += abs(tmp) + 1

        elif not j & 1 and tmp >= 0:

            sum = -1

            res += abs(tmp) + 1

        else:

            sum = tmp

    return res





print((min(cost_e(), cost_o())))

n = int(eval(input()))

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





def cost(t):

    res = 0

    sum = 0

    for y in s:

        sum += y

        if sum * t <= 0:

            res += abs(sum - t)

            sum = t

        t *= -1

    return res





print((min(cost(1), cost(-1))))

from functools import lru_cache

n = int(eval(input()))
s = list(map(int, input().split()))


@lru_cache(maxsize=None)
def cost_e():
    res = 0
    sum = 0
    for j, y in enumerate(s, 1):
        tmp = sum + y
        if j & 1 and tmp >= 0:
            sum = -1
            res += abs(tmp) + 1
        elif not j & 1 and tmp <= 0:
            sum = 1
            res += abs(tmp) + 1
        else:
            sum = tmp
    return res


@lru_cache(maxsize=None)
def cost_o():
    res = 0
    sum = 0
    for j, y in enumerate(s, 1):
        tmp = sum + y
        if j & 1 and tmp <= 0:
            sum = 1
            res += abs(tmp) + 1
        elif not j & 1 and tmp >= 0:
            sum = -1
            res += abs(tmp) + 1
        else:
            sum = tmp
    return res


print((min(cost_e(), cost_o())))

n = int(eval(input()))
s = list(map(int, input().split()))


def cost(t):
    res = 0
    sum = 0
    for y in s:
        sum += y
        if sum * t <= 0:
            res += abs(sum - t)
            sum = t
        t *= -1
    return res


print((min(cost(1), cost(-1))))

-from functools import lru_cache - -@lru_cache(maxsize=None) -def cost_e(): +def cost(t): -    for j, y in enumerate(s, 1): -        tmp = sum + y -        if j & 1 and tmp >= 0: -            sum = -1 -            res += abs(tmp) + 1 -        elif not j & 1 and tmp <= 0: -            sum = 1 -            res += abs(tmp) + 1 -        else: -            sum = tmp +    for y in s: +        sum += y +        if sum * t <= 0: +            res += abs(sum - t) +            sum = t +        t *= -1 -@lru_cache(maxsize=None) -def cost_o(): -    res = 0 -    sum = 0 -    for j, y in enumerate(s, 1): -        tmp = sum + y -        if j & 1 and tmp <= 0: -            sum = 1 -            res += abs(tmp) + 1 -        elif not j & 1 and tmp >= 0: -            sum = -1 -            res += abs(tmp) + 1 -        else: -            sum = tmp -    return res - - -print((min(cost_e(), cost_o()))) +print((min(cost(1), cost(-1))))