#include <bits/stdc++.h>
using namespace std;
string s[10000];
int main() {
  int n, x, sum = 0, ans = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> x;
    sum += x;
    if (sum < 0) {
      ++ans;
      sum = 0;
    }
  }
  cout << (ans) << endl;
  return 0;
}
