#include <bits/stdc++.h>
using namespace std;
int n, a[5005], h[5005], s[5005], b[5005];
void Nhap() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i], s[i] = s[i - 1] + a[i];
}
void process() {
  h[1] = a[1];
  int res = 0;
  for (int i = 2; i <= n; i++) {
    int j = i - 1;
    while (j > 0 && s[i] - s[j] < h[j]) j--;
    b[i] = i - j - 1 + b[j];
    h[i] = s[i] - s[j];
  }
  cout << b[n];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  Nhap();
  process();
}
