#include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin>>n;
int sa=0;
int total=0;
loop(n){
long long val;
cin>>val;
total=total+val;
while(total<=0){
sa+=(total*-1)+1;
total=1;
}
}
cout<<sa<<endl;
return 0;
}