#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll rs(vector<ll>& sum, int l, int r) {
return sum[r]-(l?sum[l-1]:0);
}
int main() {
int n;
cin>>n;
vector<ll> a(n);
for(int i=0;i<n;++i) {
cin>>a[i];
}
vector<ll> sum(n,0);
sum[0]=a[0];
for(int i=1;i<n;++i) {
sum[i]=sum[i-1]+a[i];
}
vector<ll> R(n,0), L(n,0);
R[n-1]=a[n-1];
for(int i=n-2;i>=0;i--) {
R[i]=min(R[i+1]+a[i], a[i]);
}
L[0]=a[0];
for(int i=1;i<n;++i) {
L[i]=min(L[i-1], sum[i]);
}
int ans=0;
for(int i=0;i<n;++i) {
if(R[i]>=0 && rs(sum,i,n-1)+L[i-1]>=0) {
ans++;
}
}
cout<<ans<<"\n";
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnR5cGVkZWYgbG9uZyBsb25nIGxsOwoKbGwgcnModmVjdG9yPGxsPiYgc3VtLCBpbnQgbCwgaW50IHIpIHsKCXJldHVybiBzdW1bcl0tKGw/c3VtW2wtMV06MCk7Cn0KCmludCBtYWluKCkgewoJaW50IG47CgljaW4+Pm47Cgl2ZWN0b3I8bGw+IGEobik7Cglmb3IoaW50IGk9MDtpPG47KytpKSB7CgkJY2luPj5hW2ldOwoJfQoJCgl2ZWN0b3I8bGw+IHN1bShuLDApOwoJc3VtWzBdPWFbMF07Cglmb3IoaW50IGk9MTtpPG47KytpKSB7CgkJc3VtW2ldPXN1bVtpLTFdK2FbaV07Cgl9CgkKCXZlY3RvcjxsbD4gUihuLDApLCBMKG4sMCk7CglSW24tMV09YVtuLTFdOwoJZm9yKGludCBpPW4tMjtpPj0wO2ktLSkgewoJCVJbaV09bWluKFJbaSsxXSthW2ldLCAgYVtpXSk7CgkJCgl9CgkKCUxbMF09YVswXTsKCWZvcihpbnQgaT0xO2k8bjsrK2kpIHsKCQlMW2ldPW1pbihMW2ktMV0sIHN1bVtpXSk7Cgl9CgkKCWludCBhbnM9MDsKCWZvcihpbnQgaT0wO2k8bjsrK2kpIHsKCQkKCQlpZihSW2ldPj0wICYmIHJzKHN1bSxpLG4tMSkrTFtpLTFdPj0wKSB7CgkJCWFucysrOwoJCX0KCX0KCQoJY291dDw8YW5zPDwiXG4iOwoJCglyZXR1cm4gMDsKfQo=