#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) { return b != 0 ? GCD(b, a % b) : a; }
long long LCM(long long a, long long b) { return a * (b / GCD(a, b)); }
long long Pow(long long n, long long e) {
  if (e == 0) return 1;
  if (e == 1)
    return n;
  else if (e & 1) {
    long long t = Pow(n, e / 2);
    return n * t * t;
  } else {
    long long t = Pow(n, e / 2);
    return t * t;
  }
}
int h[5005];
int dp[5005][5005];
int main() {
  int N;
  scanf("%d", &N);
  for (int i = (1), max_ = (N + 1); i < max_; ++i) scanf("%d", &h[i]);
  for (int i = 0, max_ = (N + 1); i < max_; ++i)
    for (int j = 0, max_ = (N + 1); j < max_; ++j) dp[i][j] = 100000000;
  dp[0][0] = 0;
  for (int i = 0, max_ = (N + 1); i < max_; ++i) {
    int k = -1, sum = 0;
    for (int j = (i + 1), max_ = (N + 1); j < max_; ++j) {
      sum += h[j];
      while (k + 1 < N && dp[i][k + 1] <= sum) ++k;
      if (k >= 0) {
        dp[j][k + 1] = min(dp[j][k + 1], sum);
      }
    }
    for (int k = (N)-1; k >= 0; --k)
      dp[i + 1][k] = min(dp[i + 1][k], dp[i + 1][k + 1]);
  }
  int maxK = 0;
  for (int k = 0, max_ = (N + 1); k < max_; ++k)
    if (dp[N][k] < 100000000) maxK = k;
  printf("%d\n", N - maxK);
  return 0;
}
