#include <bits/stdc++.h>
using namespace std;
const int N = 3002;
int dp[N][N], a[N], n;
int main(int argc, char const *argv[])
{
scanf("%d", &n);
for (int i = 0; i < n; ++i)
{
scanf("%d", a+i);
dp[0][i] = 1;
}
for (int i = 1; i < n; ++i)
{
int sum_cur = 0;
int sum_prev = 0;
int x = i;
int dpp = 0;
for (int j = i; j < n; ++j)
{
sum_cur += a[j];
dp[i][j] = dpp;
while (x) // monotonic property
{
if (sum_prev + a[x - 1] > sum_cur) break;
sum_prev += a[--x];
dp[i][j] = max(dp[x][i-1] + 1, dp[i][j]);
}
dpp = dp[i][j];
}
}
// for (int i = 0; i < n; ++i) {
// for (int j = 0; j < n; ++j)
// printf("%d ", dp[i][j]);
// puts("");
// }
int ans = 0;
for (int i = 0; i < n; ++i)
ans = max(ans, dp[i][n-1]);
printf("%d\n", ans);
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmNvbnN0IGludCBOID0gMzAwMjsKaW50IGRwW05dW05dLCBhW05dLCBuOwoKaW50IG1haW4oaW50IGFyZ2MsIGNoYXIgY29uc3QgKmFyZ3ZbXSkKewogIHNjYW5mKCIlZCIsICZuKTsKICBmb3IgKGludCBpID0gMDsgaSA8IG47ICsraSkKICB7CiAgICBzY2FuZigiJWQiLCBhK2kpOwogICAgZHBbMF1baV0gPSAxOwogIH0KICBmb3IgKGludCBpID0gMTsgaSA8IG47ICsraSkKICB7CiAgICBpbnQgc3VtX2N1ciA9IDA7CiAgICBpbnQgc3VtX3ByZXYgPSAwOwogICAgaW50IHggPSBpOwogICAgaW50IGRwcCA9IDA7CiAgICBmb3IgKGludCBqID0gaTsgaiA8IG47ICsraikKICAgIHsKICAgICAgc3VtX2N1ciArPSBhW2pdOwoKICAgICAgZHBbaV1bal0gPSBkcHA7CiAgICAgIHdoaWxlICh4KSAgICAvLyBtb25vdG9uaWMgcHJvcGVydHkgCiAgICAgIHsKICAgICAgICBpZiAoc3VtX3ByZXYgKyBhW3ggLSAxXSA+IHN1bV9jdXIpIGJyZWFrOwogICAgICAgIHN1bV9wcmV2ICs9IGFbLS14XTsKICAgICAgICBkcFtpXVtqXSA9IG1heChkcFt4XVtpLTFdICsgMSwgZHBbaV1bal0pOwogICAgICB9CiAgICAgIGRwcCA9IGRwW2ldW2pdOwogICAgfQogIH0KCiAgLy8gZm9yIChpbnQgaSA9IDA7IGkgPCBuOyArK2kpIHsKICAvLyAgIGZvciAoaW50IGogPSAwOyBqIDwgbjsgKytqKQogIC8vICAgICBwcmludGYoIiVkICIsIGRwW2ldW2pdKTsKICAvLyAgIHB1dHMoIiIpOwogIC8vIH0KCiAgaW50IGFucyA9IDA7CiAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyArK2kpCiAgICBhbnMgPSBtYXgoYW5zLCBkcFtpXVtuLTFdKTsKICBwcmludGYoIiVkXG4iLCBhbnMpOwoKICByZXR1cm4gMDsKfQ==