#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n = 0,sum=0,ans=0;
int w=0;
cin>>n;
for(int i=0;i<n;i++){
cin>>w;
sum += w;
if(sum > 0) continue;
ans+= 1 - sum;
sum = 1;
}
cout<<ans;
return 0;
}