// Born_To_Laugh - Hughie Do
#include <bits/stdc++.h>
#define alle(AC) AC.begin(), AC.end()
#define fi first
#define se second
using namespace std;
typedef long long ll;
[[maybe_unused]] const int MOD = 998244353, INF = 1e9 + 7;
const int maxn = 5e5 + 10;
int n, a[maxn];
ll pref[maxn];
ll dp[maxn], last[maxn];
void solve(){
cin >> n;
for(int i=1; i<=n; ++i) cin >> a[i];
for(int i=1; i<=n; ++i) pref[i] = pref[i - 1] + a[i];
int j = 0;
for(int i=1; i<=n; ++i){
while(j + 1 < i && pref[i] >= last[j + 1] + pref[j + 1]) j++;
dp[i] = dp[j] + 1;
last[i] = pref[i] - pref[j];
}
cout << dp[n] << '\n';
}
signed main(){
// freopen("inp.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
solve();
}