#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const int MAXN = 1000007;
int n, a[MAXN];
int f[MAXN], height[MAXN], sum[MAXN];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) sum[i + 1] = sum[i] + a[i];
  deque<pair<int, int> > dQ;
  f[0] = 0;
  height[0] = 0;
  dQ.push_back(make_pair(0, 0));
  int last = -1;
  for (int i = 1; i <= n; ++i) {
    while (dQ.size() && dQ.front().first <= sum[i]) {
      last = dQ.front().second;
      dQ.pop_front();
    }
    f[i] = f[last] + 1;
    height[i] = sum[i] - sum[last];
    while (dQ.size() && height[i] + sum[i] <= dQ.back().first) dQ.pop_back();
    dQ.push_back(make_pair(height[i] + sum[i], i));
  }
  cout << n - f[n] << endl;
  return 0;
}
