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