#include <bits/stdc++.h>
using namespace std;
inline long long getint() {
  long long ssum = 0, ff = 1;
  char ch;
  for (ch = getchar(); !isdigit(ch) && ch != '-'; ch = getchar())
    ;
  if (ch == '-') ff = -1, ch = getchar();
  for (; isdigit(ch); ch = getchar()) ssum = ssum * 10 + ch - '0';
  return ssum * ff;
}
const long long M = 5005;
long long f[M], g[M], n, m, s[M], a[M];
signed main() {
  cin >> n;
  for (long long i = 1; i <= n; i++) a[i] = getint();
  for (long long i = 1; i <= n; i++) s[i] = s[i - 1] + a[i];
  f[1] = 1;
  g[1] = a[1];
  for (long long i = 2; i <= n; i++) {
    for (long long j = 0; j < i; j++) {
      if (s[i] - s[j] >= g[j]) {
        if (f[i] <= f[j] + 1) {
          f[i] = f[j] + 1;
          g[i] = s[i] - s[j];
        }
      }
    }
  }
  cout << n - f[n] << endl;
  return 0;
}
