#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> A(n + 1, 0);
  for (int i = (int)(1); i <= (int)(n); ++i) scanf("%d", &A[i]);
  vector<int> H(n + 1, 0), W(n + 1, 0);
  for (int i = (int)(1); i <= (int)(n); ++i) {
    int w = A[i];
    for (int j = (int)(i - 1); j >= (int)(0); --j) {
      if (w >= W[j] && H[j] + 1 > H[i]) {
        H[i] = H[j] + 1;
        W[i] = w;
      }
      w += A[j];
    }
  }
  printf("%d\n", n - H[n]);
}
