#include <bits/stdc++.h>
using namespace std;
const int MAXN = int(1e4) + 4;
int a[MAXN], h[MAXN], c[MAXN];
int n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    h[i] = a[i];
    int j = i - 1;
    while (h[j] > h[i] && j > 0) {
      h[i] += a[j];
      c[i]++;
      j--;
    }
    c[i] += c[j];
  }
  cout << c[n] << endl;
  return 0;
}
