#include <stdio.h>
#include <stdlib.h>
int main()
{
int N = 0;
int sum = 0;
int x = 0;
scanf("%d", &N);
for(int i=1;i<=N;i++){
int a = 0;
scanf("%d",&a);
sum += a;
if(sum <= 0){
x = (sum*-1) + 1;
}
}
printf("%d\n",x);
return 0;
}