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