#include <iostream>
using namespace std;
int main() {
int com[100001];
com[0] = 0;
int n; cin >> n;
int tmp, ans = 0;
for (int i = 1; i <= n; i++) {
cin >> tmp;
com[i] = com[i - 1] + tmp;
if (com[i] <= 0) {
ans += 1-com[i];
com[i] = 1;
}
}
cout << abs(ans);
//system("pause");
return 0;
}