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