#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
int main() {
  int n;
  scanf("%d", &n);
  int h[5000];
  for (int i = 0; i < (n); i++) scanf("%d", h + i);
  int sum[5001] = {};
  for (int i = 0; i < (n); i++) sum[i + 1] = sum[i] + h[i];
  static int dp[5000][5000];
  for (int i = 0; i < (n); i++)
    for (int j = 0; j < (n); j++) dp[i][j] = (i == 0 ? 1 : -INF);
  for (int i = 0; i < (n); i++) {
    int iter = i + 1;
    for (int j = i; j < n - 1; j++) {
      dp[i][j + 1] = max(dp[i][j + 1], dp[i][j]);
      for (int &k = iter; k < n; k++) {
        if (sum[k + 1] - sum[j + 1] >= sum[j + 1] - sum[i]) {
          dp[j + 1][k] = max(dp[j + 1][k], dp[i][j] + 1);
          break;
        }
      }
    }
  }
  int res = 1;
  for (int i = 0; i < (n); i++) res = max(res, dp[i][n - 1]);
  printf("%d\n", n - res);
  return 0;
}
