#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  long long int n, s = 0, k = 0;
  cin >> n;
  while (n--) {
    int a;
    cin >> a;
    if (s + a < 0) {
      k++;
    } else {
      s += a;
    }
  }
  cout << k;
  return 0;
}
