n = int(input())
tmp = input()
k = tmp.split(" ")
current = 0
min = int(k[0])
for c in k:
current += int(c)
if (min >= current):
min = current
if (min <= 0):
min = min * -1
min = min + 1
print(min)
else:
print(0)