#include <bits/stdc++.h>
using namespace std;
int n, a[5007], px[5007];
int len[5007];
int h[5007], r = 0;
int H[5007], R = 1;
int ans = 0;
int check(int p, int h[], int fi) {
  int l = 1, r = fi, res = 0;
  while (l <= r) {
    int mid = (l + r) / 2;
    int now = h[mid];
    if (px[p] >= px[now] + len[now]) {
      res = mid;
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  return res;
}
void up(int p, int pre) {
  r = R;
  for (int i = 1; i <= R; i++) {
    h[i] = H[i];
  }
  R = 0;
  H[++R] = p;
  len[p] = px[p] - px[pre];
}
void gao(int p, int pre) {
  len[p] = px[p] - px[pre];
  while (R > 0) {
    int now = H[R];
    if (len[p] + px[p] <= len[now] + px[now]) {
      R--;
    } else {
      break;
    }
  }
  H[++R] = p;
}
void print() {
  for (int i = 1; i <= R; i++) {
    printf("%d ", H[i]);
  }
  puts("");
  for (int i = 1; i <= r; i++) {
    printf("%d ", h[i]);
  }
  puts("\n");
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    px[i] = px[i - 1] + a[i];
  }
  for (int i = 1; i <= n; i++) {
    int p = check(i, H, R);
    if (p) {
      ans++;
      up(i, H[p]);
    } else {
      p = check(i, h, r);
      gao(i, h[p]);
    }
  }
  printf("%d\n", n - ans);
  return 0;
}
