#include<iostream>
#include<algorithm>
using namespace std ;
int main()
{
int n, p=0 ,l = 0 ;
cin>>n;
int arr[n];
for(int i = 0 ; i<n ; i++)
{
cin>>arr[i];
p += arr[i];
if(p <=0 ) {l+=(abs(p-1)); p+=l;}
}
cout<<l;
}