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