#include <bits/stdc++.h>
using namespace std;
int n, a[5010];
int dp[5010][5010];
void update(int& x, int y, int z) {
  if (y == -1) return;
  y += z;
  if (x == -1 || x < y) x = y;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    a[i] += a[i - 1];
  }
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= n; i++) {
    dp[i][1] = 1;
    int now = -1, j, k;
    for (j = i, k = i + 1; j >= 1; j--) {
      for (; k <= n && a[k] - a[i] < a[i] - a[j - 1]; k++)
        update(dp[k][i + 1], now, 1);
      update(now, dp[i][j], 0);
    }
    for (; k <= n; k++) update(dp[k][i + 1], now, 1);
  }
  int bes = -1;
  for (int i = 1; i <= n; i++) update(bes, dp[n][i], 0);
  printf("%d\n", n - bes);
  return 0;
}
