#include <iostream>
using namespace std;
const int N = 1e5 + 5;
int main() {
int n, a[N],lend=0,profit=0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < n; i++) {
profit += a[i];
if (profit < 1 ){
lend += (-1 * profit) + 1;
profit += (-1 * profit) + 1;
}
}
cout << lend;
return 0;
}