#include <bits/stdc++.h>
using namespace std;
int n;
int a[100010];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  int ans = 0, v = 0;
  for (int i = 0; i < n; ++i) {
    ans += a[i];
    if (ans < 0) {
      ans = 0;
      v++;
    }
  }
  printf("%d\n", v);
  return 0;
}
