#include <bits/stdc++.h>
using namespace std;
const int N = 5005;
const int INF = 100000005;
int h[N], dp[N][N], p[N], sum[N], key[N][N];
int main() {
  int n, i, j;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", h + i);
    sum[i] = sum[i - 1] + h[i];
  }
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) dp[i][j] = 0;
  dp[1][1] = 1;
  key[1][1] = 1;
  for (i = 1; i <= n; i++) p[i] = i + 1;
  for (i = 2; i <= n; i++) {
    for (j = 1; j < i; j++) {
      while (p[j] > 1 && sum[j] - sum[p[j] - 2] <= sum[i] - sum[j]) {
        p[j]--;
      }
    }
    dp[i][1] = 1;
    for (j = 1; j < i; j++) {
      if (key[j][p[j]]) dp[i][j + 1] = key[j][p[j]] + 1;
    }
    for (j = n; j > 0; j--) {
      key[i][j] = max(dp[i][j], key[i][j + 1]);
    }
  }
  int ret = 0;
  for (i = 1; i <= n; i++)
    if (dp[n][i] > ret) ret = dp[n][i];
  printf("%d\n", n - ret);
  return 0;
}
