#include <bits/stdc++.h>
using namespace std;
int main() {
  int num, n;
  cin >> n;
  int sum = 0, counter = 0;
  for (int i = 1; i <= n; i++) {
    cin >> num;
    if (num + sum < 0) {
      counter++;
    } else {
      sum += num;
    }
  }
  cout << counter;
}
