n = int(eval(input()))

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

sun = 0

ans1 = 0

for i in range(n):

  if i == 0:

    SUN = 1

  else:

    SUN = sun

  now = a[i]

  if SUN * (sun+now) >= 0:

    ans1 += abs(sun+now) + 1

    if SUN > 0:

      sun = -1

    else:

      sun = 1

  else:

    sun += now

sun = 0

ans2 = 0

for i in range(n):

  now = a[i]

  if i == 0:

    SUN = -1

  else:

    SUN = sun

  if SUN * (sun+now) >= 0:

    ans2 += abs(sun+now) + 1

    if SUN > 0:

      sun = -1

    else:

      sun = 1

  else:

    sun += now

#print(ans1,ans2)

print((min(ans1,ans2)))
n = int(eval(input()))

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

can = []

ans = 0

now = 0

for i in range(n):

  now += a[i]

  if i % 2 == 0:

    if now <= 0:

      ans += 1 - now

      now = 1

  else:

    if now >= 0:

      ans += 1 + now

      now = -1

can.append(ans)

ans = 0

now = 0

for i in range(n):

  now += a[i]

  if i % 2 == 1:

    if now <= 0:

      ans += 1 - now

      now = 1

  else:

    if now >= 0:

      ans += 1 + now

      now = -1

can.append(ans)

print((min(can)))
n = int(eval(input()))
a = list(map(int, input().split()))
sun = 0
ans1 = 0
for i in range(n):
    if i == 0:
        SUN = 1
    else:
        SUN = sun
    now = a[i]
    if SUN * (sun + now) >= 0:
        ans1 += abs(sun + now) + 1
        if SUN > 0:
            sun = -1
        else:
            sun = 1
    else:
        sun += now
sun = 0
ans2 = 0
for i in range(n):
    now = a[i]
    if i == 0:
        SUN = -1
    else:
        SUN = sun
    if SUN * (sun + now) >= 0:
        ans2 += abs(sun + now) + 1
        if SUN > 0:
            sun = -1
        else:
            sun = 1
    else:
        sun += now
# print(ans1,ans2)
print((min(ans1, ans2)))

n = int(eval(input()))
a = list(map(int, input().split()))
can = []
ans = 0
now = 0
for i in range(n):
    now += a[i]
    if i % 2 == 0:
        if now <= 0:
            ans += 1 - now
            now = 1
    else:
        if now >= 0:
            ans += 1 + now
            now = -1
can.append(ans)
ans = 0
now = 0
for i in range(n):
    now += a[i]
    if i % 2 == 1:
        if now <= 0:
            ans += 1 - now
            now = 1
    else:
        if now >= 0:
            ans += 1 + now
            now = -1
can.append(ans)
print((min(can)))

-sun = 0 -ans1 = 0 +can = [] +ans = 0 +now = 0 -    if i == 0: -        SUN = 1 +    now += a[i] +    if i % 2 == 0: +        if now <= 0: +            ans += 1 - now +            now = 1 -        SUN = sun -    now = a[i] -    if SUN * (sun + now) >= 0: -        ans1 += abs(sun + now) + 1 -        if SUN > 0: -            sun = -1 -        else: -            sun = 1 +        if now >= 0: +            ans += 1 + now +            now = -1 +can.append(ans) +ans = 0 +now = 0 +for i in range(n): +    now += a[i] +    if i % 2 == 1: +        if now <= 0: +            ans += 1 - now +            now = 1 -        sun += now -sun = 0 -ans2 = 0 -for i in range(n): -    now = a[i] -    if i == 0: -        SUN = -1 -    else: -        SUN = sun -    if SUN * (sun + now) >= 0: -        ans2 += abs(sun + now) + 1 -        if SUN > 0: -            sun = -1 -        else: -            sun = 1 -    else: -        sun += now -# print(ans1,ans2) -print((min(ans1, ans2))) +        if now >= 0: +            ans += 1 + now +            now = -1 +can.append(ans) +print((min(can)))