#include<bits/stdc++.h>
using namespace std;
int n;
int a[1000005];
long long sum[1000005];
long long p;
int ans=0;
map<long long,int>in;
vector<long long>v;
int st[4000006];
int left(int p){return (p<<1);}
int right(int p){return (p<<1)+1;}
void add(int p,int l,int r,int x)
{
if(l>x||r<x)return;
if(l==r)
{
if(l==x)
{
st[p]++;
}
return;
}
add(left(p),l,(l+r)/2,x);
add(right(p),((l+r)/2)+1,r,x);
st[p]=st[left(p)]+st[right(p)];
}
int sumq(int p,int l,int r,int i,int j)
{
if(r<i||l>j)return 0;
if(l>=i&&r<=j)return st[p];
return sumq(left(p),l,(l+r)/2,i,j)+sumq(right(p),((l+r)/2)+1,r,i,j);
}
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
scanf("%d",&a[i]);
scanf("%d",&p);
for(int i=1;i<=n;i++){
sum[i]=sum[i-1]+(a[i]-p);
v.push_back(sum[i]);
}
sort(v.begin(),v.end());
in[v[0]]=0;
int c=1;
for(int i=1;i<v.size();i++)
{
if(v[i]!=v[i-1])
{
in[v[i]]=c;
c++;
}
}
for(int i=1;i<=n;i++)
{
if(sum[i]>=0)
ans++;
ans+=sumq(1,0,c-1,0,in[sum[i]]);
add(1,0,c-1,in[sum[i]]);
}
printf("%d\n",ans);
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKaW50IG47CmludCBhWzEwMDAwMDVdOwpsb25nIGxvbmcgc3VtWzEwMDAwMDVdOwpsb25nIGxvbmcgcDsKaW50IGFucz0wOwptYXA8bG9uZyBsb25nLGludD5pbjsKdmVjdG9yPGxvbmcgbG9uZz52OwppbnQgc3RbNDAwMDAwNl07CmludCBsZWZ0KGludCBwKXtyZXR1cm4gKHA8PDEpO30KaW50IHJpZ2h0KGludCBwKXtyZXR1cm4gKHA8PDEpKzE7fQp2b2lkIGFkZChpbnQgcCxpbnQgbCxpbnQgcixpbnQgeCkKewogICAgaWYobD54fHxyPHgpcmV0dXJuOwogICAgaWYobD09cikKICAgIHsKICAgICAgICBpZihsPT14KQogICAgICAgIHsKICAgICAgICAgICAgc3RbcF0rKzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuOwogICAgfQogICAgYWRkKGxlZnQocCksbCwobCtyKS8yLHgpOwogICAgYWRkKHJpZ2h0KHApLCgobCtyKS8yKSsxLHIseCk7CiAgICBzdFtwXT1zdFtsZWZ0KHApXStzdFtyaWdodChwKV07Cn0KaW50IHN1bXEoaW50IHAsaW50IGwsaW50IHIsaW50IGksaW50IGopCnsKICAgIGlmKHI8aXx8bD5qKXJldHVybiAwOwogICAgaWYobD49aSYmcjw9ailyZXR1cm4gIHN0W3BdOwogICAgcmV0dXJuIHN1bXEobGVmdChwKSxsLChsK3IpLzIsaSxqKStzdW1xKHJpZ2h0KHApLCgobCtyKS8yKSsxLHIsaSxqKTsKfQppbnQgbWFpbigpCnsKICAgIHNjYW5mKCIlZCIsJm4pOwogICAgZm9yKGludCBpPTE7aTw9bjtpKyspCiAgICAgICAgc2NhbmYoIiVkIiwmYVtpXSk7CiAgICBzY2FuZigiJWQiLCZwKTsKICAgIGZvcihpbnQgaT0xO2k8PW47aSsrKXsKICAgICAgICBzdW1baV09c3VtW2ktMV0rKGFbaV0tcCk7CiAgICAgICAgdi5wdXNoX2JhY2soc3VtW2ldKTsKICAgIH0KICAgIHNvcnQodi5iZWdpbigpLHYuZW5kKCkpOwogICAgaW5bdlswXV09MDsKICAgIGludCBjPTE7CiAgICBmb3IoaW50IGk9MTtpPHYuc2l6ZSgpO2krKykKICAgIHsKICAgICAgICBpZih2W2ldIT12W2ktMV0pCiAgICAgICAgewogICAgICAgICAgICBpblt2W2ldXT1jOwogICAgICAgICAgICBjKys7CiAgICAgICAgfQogICAgfQogICAgZm9yKGludCBpPTE7aTw9bjtpKyspCiAgICB7CiAgICAgICAgaWYoc3VtW2ldPj0wKQogICAgICAgICAgICBhbnMrKzsKICAgICAgICBhbnMrPXN1bXEoMSwwLGMtMSwwLGluW3N1bVtpXV0pOwogICAgICAgIGFkZCgxLDAsYy0xLGluW3N1bVtpXV0pOwogICAgfQogICAgcHJpbnRmKCIlZFxuIixhbnMpOwogICAgcmV0dXJuIDA7Cn0=