#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
  int n;
  cin >> n;
  int x, s = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (x > 0)
      s += x;
    else {
      if (s > 0)
        s += x;
      else
        ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
