#include <bits/stdc++.h>
#define int long long
int pref[1000100];
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
std::cin >> n;
for(int i=1;i<=n;i++){
std::cin >> pref[i];
pref[i]+=pref[i-1];
}
std::vector<std::pair<int,int>> dp(n+2,{0,0});
std::pair<int,int> curr={0,0};
for(int i=1;i<=n;i++)dp[i]={1,-pref[i]};
for(int i=1;i<=n;i++){
curr.second-=pref[i]-pref[i-1];
curr=std::max(dp[i],curr);
int l=i+1,r=n;
while(l<r){
int mid = (l+r)/2;
if(pref[mid]-pref[i]>=-curr.second){
r=mid;
}
else{
l=mid+1;
}
}
dp[r]=std::max(dp[r],{curr.first+1,-(pref[r]-pref[i])});
//std::cout << curr.first << ' ';
}
std::cout << curr.first;
}