n = int(input())
sum = 0
A = [0] * n
for i, num in enumerate(input().split()):
  sum += int(num)
  A[i] = sum
print(A)
  
counter_plus = 0
is_plus = True
temp = 0
for i in range(n):
  if is_plus == True:
    temp += -min(0, A[i] - 1 + temp)
    print(is_plus, temp)
    counter_plus += temp
  else:
    temp = -max(0, A[i] + 1 + temp)
    print(is_plus, temp)
    counter_plus += -temp
  is_plus = not(is_plus)

print()
  
counter_minus = 0
is_plus = False
temp = 0
for i in range(n):
  if is_plus == True:
    temp += -min(0, A[i] - 1 + temp)
    print(is_plus, temp)
    counter_minus += temp
  else:
    temp = -max(0, A[i] + 1 + temp)
    print(is_plus, temp)
    counter_minus += -temp
  is_plus = not(is_plus)
print(min(counter_plus, counter_minus))

# Example run
# Input:
224
-3753932
# Output:
[-3753932, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
True 3753933
False -3753934
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2

False 0
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
False -2
True 1
334