n=int(eval(input()))

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

fg=[1,-1]

ret = [0]*2

tot = [0]*2

il = list(range(n))

jl = list(range(2))

for i in il:

  for j in jl:

    tot[j]+=a[i]

    if tot[j]*fg[j]<=0:

      ret[j] += abs(fg[j] - tot[j])

      tot[j] += fg[j] - tot[j]

    fg[j]*=-1

print((min(ret)))
n=int(eval(input()))

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

def ma():

  fg=[1,-1]

  ret = [0]*2

  tot = [0]*2

  il = list(range(n))

  jl = list(range(2))

  for i in il:

    for j in jl:

      tot[j]+=a[i]

      if tot[j]*fg[j]<=0:

        ret[j] += abs(fg[j] - tot[j])

        tot[j] += fg[j] - tot[j]

      fg[j]*=-1

  return min(ret)

print((ma()))
n = int(eval(input()))
a = list(map(int, input().split()))
fg = [1, -1]
ret = [0] * 2
tot = [0] * 2
il = list(range(n))
jl = list(range(2))
for i in il:
    for j in jl:
        tot[j] += a[i]
        if tot[j] * fg[j] <= 0:
            ret[j] += abs(fg[j] - tot[j])
            tot[j] += fg[j] - tot[j]
        fg[j] *= -1
print((min(ret)))

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


def ma():
    fg = [1, -1]
    ret = [0] * 2
    tot = [0] * 2
    il = list(range(n))
    jl = list(range(2))
    for i in il:
        for j in jl:
            tot[j] += a[i]
            if tot[j] * fg[j] <= 0:
                ret[j] += abs(fg[j] - tot[j])
                tot[j] += fg[j] - tot[j]
            fg[j] *= -1
    return min(ret)


print((ma()))

-fg = [1, -1] -ret = [0] * 2 -tot = [0] * 2 -il = list(range(n)) -jl = list(range(2)) -for i in il: -    for j in jl: -        tot[j] += a[i] -        if tot[j] * fg[j] <= 0: -            ret[j] += abs(fg[j] - tot[j]) -            tot[j] += fg[j] - tot[j] -        fg[j] *= -1 -print((min(ret))) + + +def ma(): +    fg = [1, -1] +    ret = [0] * 2 +    tot = [0] * 2 +    il = list(range(n)) +    jl = list(range(2)) +    for i in il: +        for j in jl: +            tot[j] += a[i] +            if tot[j] * fg[j] <= 0: +                ret[j] += abs(fg[j] - tot[j]) +                tot[j] += fg[j] - tot[j] +            fg[j] *= -1 +    return min(ret) + + +print((ma()))