#include <bits/stdc++.h>
using namespace std;
int h[5005], pref[5005], dp[5005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &h[i]);
    pref[i] = pref[i - 1] + h[i];
    for (int j = i - 1; j >= 0; j--) {
      if (pref[i] - pref[j] >= h[j]) {
        dp[i] = dp[j] + i - j - 1;
        h[i] = pref[i] - pref[j];
        break;
      }
    }
  }
  printf("%d\n", dp[n]);
  return 0;
}
