#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
typedef long long int ll;
#define loop(n) for(ll i=0;i< ll(n); i++)
void solve() {
ll n;
cin >> n;
int sa= 0;
int total = 0;
loop(n) {
ll val;
cin >> val;
total += val;
while(total <= 0 ) {
sa += (total*-1) + 1;
total = 1;
}
}
cout << sa << endl;
}
int main() {
solve();
return 0;
}