#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef set<int>::iterator ssii;
#define Cmp(a, b) memcmp(a, b, sizeof(b))
#define Cpy(a, b) memcpy(a, b, sizeof(b))
#define Set(a, v) memset(a, v, sizeof(a))
#define debug(x) cout << #x << ": " << x << endl
#define _forS(i, l, r) for(set<int>::iterator i = (l); i != (r); i++)
#define _rep(i, l, r) for(int i = (l); i <= (r); i++)
#define _for(i, l, r) for(int i = (l); i < (r); i++)
#define _forDown(i, l, r) for(int i = (l); i >= r; i--)
#define debug_(ch, i) printf(#ch"[%d]: %d\n", i, ch[i])
#define debug_m(mp, p) printf(#mp"[%d]: %d\n", p->first, p->second)
#define debugS(str) cout << "dbg: " << str << endl;
#define debugArr(arr, x, y) _for(i, 0, x) { _for(j, 0, y) printf("%c", arr[i][j]); printf("\n"); }
#define _forPlus(i, l, d, r) for(int i = (l); i + d < (r); i++)
#define lowbit(i) (i & (-i))
#define MPR(a, b) make_pair(a, b)
pair<int, int> crack(int n) {
int st = sqrt(n);
int fac = n / st;
while (n % st) {
st += 1;
fac = n / st;
}
return make_pair(st, fac);
}
inline ll qpow(ll a, int n) {
ll ans = 1;
for(; n; n >>= 1) {
if(n & 1) ans *= 1ll * a;
a *= a;
}
return ans;
}
template <class T>
inline bool chmax(T& a, T b) {
if(a < b) {
a = b;
return true;
}
return false;
}
template <class T>
inline bool chmin(T& a, T b) {
if(a > b) {
a = b;
return true;
}
return false;
}
// ============================================================== //
const int maxn = 1e5 + 10;
const int inf = 0x3f3f3f3f;
int n, a[maxn];
int S[maxn], que[maxn];
int f[maxn], h[maxn];
inline int calc(int j) {
return f[j] + S[j];
}
void dp() {
int l = 1, r = 1;
que[l] = 0;
int p = 0;
_rep(i, 1, n) {
while (l <= r && f[que[l]] <= S[i] - S[que[l]]) chmax(p, que[l]), l++;
h[i] = h[p] + 1;
f[i] = S[i] - S[p];
while (l <= r && calc(que[r]) >= calc(i)) r--;
que[++r] = i;
}
}
void init() {
memset(S, 0, sizeof(S));
memset(que, 0, sizeof(que));
}
int main() {
//freopen("input.txt", "r", stdin);
init();
cin >> n;
_forDown(i, n, 1) {
scanf("%d", &a[i]);
}
_rep(i, 1, n) S[i] = S[i-1] + a[i];
// then dp
dp();
int ans = h[n];
printf("%d\n", ans);
}