#include <bits/stdc++.h>
int main() {
  int a, k = 0, n, i, s = 0;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a);
    s = s + a;
    if (s < 0) {
      k++;
      s = 0;
    }
  }
  printf("%d", k);
}
