#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, sum = 0, c = 0;
  cin >> n;
  while (n--) {
    int temp;
    cin >> temp;
    if (sum >= abs(temp) && temp < 0) {
      sum += temp;
    } else if (temp > 0) {
      sum += temp;
    } else {
      c++;
    }
  }
  cout << c;
  return 0;
}
