#include <bits/stdc++.h>
int N;
int H[5000 + 7];
int F[5000 + 7][5000 + 7];
int S[5000 + 7];
int Calc(int X, int Y) { return S[Y] - S[X - 1]; }
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%d", H + i);
    S[i] = S[i - 1] + H[i];
  }
  for (int i = 1; i <= N; i++) F[1][i] = 1;
  for (int i = 2; i <= N; i++)
    for (int j = i, k = i, temp = 0, record = -1; j <= N; j++) {
      for (; k > 1 && Calc(i, j) >= Calc(k - 1, i - 1); k--) {
        if (F[k - 1][i - 1] > temp) record = k - 1, temp = F[k - 1][i - 1];
      }
      if (record == -1) temp = -9999;
      F[i][j] = temp + 1;
    }
  int Ans = 0;
  for (int k = 1; k <= N; k++)
    if (Ans < F[k][N]) Ans = F[k][N];
  printf("%d\n", N - Ans);
  return 0;
}
