#include<bits/stdc++.h>
using namespace std;
int n;
int a[1000005];
long long sum=0;
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=sum+(a[i]-p);
v.push_back(sum);
}
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++;
}
}
sum=0;
for(int i=1;i<=n;i++)
{
sum=sum+(a[i]-p);
if(sum>=0)
ans++;
ans+=sumq(1,0,c-1,0,in[sum]);
add(1,0,c-1,in[sum]);
}
printf("%d\n",ans);
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKaW50IG47CmludCBhWzEwMDAwMDVdOwpsb25nIGxvbmcgc3VtPTA7CmxvbmcgbG9uZyBwOwppbnQgYW5zPTA7Cm1hcDxsb25nIGxvbmcsaW50PmluOwp2ZWN0b3I8bG9uZyBsb25nPnY7CmludCBzdFs0MDAwMDA2XTsKaW50IGxlZnQoaW50IHApe3JldHVybiAocDw8MSk7fQppbnQgcmlnaHQoaW50IHApe3JldHVybiAocDw8MSkrMTt9CnZvaWQgYWRkKGludCBwLGludCBsLGludCByLGludCB4KQp7CiAgICBpZihsPnh8fHI8eClyZXR1cm47CiAgICBpZihsPT1yKQogICAgewogICAgICAgIGlmKGw9PXgpCiAgICAgICAgewogICAgICAgICAgICBzdFtwXSsrOwogICAgICAgIH0KICAgICAgICByZXR1cm47CiAgICB9CiAgICBhZGQobGVmdChwKSxsLChsK3IpLzIseCk7CiAgICBhZGQocmlnaHQocCksKChsK3IpLzIpKzEscix4KTsKICAgIHN0W3BdPXN0W2xlZnQocCldK3N0W3JpZ2h0KHApXTsKfQppbnQgc3VtcShpbnQgcCxpbnQgbCxpbnQgcixpbnQgaSxpbnQgaikKewogICAgaWYocjxpfHxsPmopcmV0dXJuIDA7CiAgICBpZihsPj1pJiZyPD1qKXJldHVybiAgc3RbcF07CiAgICByZXR1cm4gc3VtcShsZWZ0KHApLGwsKGwrcikvMixpLGopK3N1bXEocmlnaHQocCksKChsK3IpLzIpKzEscixpLGopOwp9CmludCBtYWluKCkKewogICAgc2NhbmYoIiVkIiwmbik7CiAgICBmb3IoaW50IGk9MTtpPD1uO2krKykKICAgICAgICBzY2FuZigiJWQiLCZhW2ldKTsKICAgIHNjYW5mKCIlZCIsJnApOwogICAgZm9yKGludCBpPTE7aTw9bjtpKyspewogICAgICAgIHN1bT1zdW0rKGFbaV0tcCk7CiAgICAgICAgdi5wdXNoX2JhY2soc3VtKTsKICAgIH0KICAgIHNvcnQodi5iZWdpbigpLHYuZW5kKCkpOwogICAgaW5bdlswXV09MDsKICAgIGludCBjPTE7CiAgICBmb3IoaW50IGk9MTtpPHYuc2l6ZSgpO2krKykKICAgIHsKICAgICAgICBpZih2W2ldIT12W2ktMV0pCiAgICAgICAgewogICAgICAgICAgICBpblt2W2ldXT1jOwogICAgICAgICAgICBjKys7CiAgICAgICAgfQogICAgfQogICAgc3VtPTA7CiAgICBmb3IoaW50IGk9MTtpPD1uO2krKykKICAgIHsKICAgICAgICBzdW09c3VtKyhhW2ldLXApOwogICAgICAgIGlmKHN1bT49MCkKICAgICAgICAgICAgYW5zKys7CiAgICAgICAgYW5zKz1zdW1xKDEsMCxjLTEsMCxpbltzdW1dKTsKICAgICAgICBhZGQoMSwwLGMtMSxpbltzdW1dKTsKICAgIH0KICAgIHByaW50ZigiJWRcbiIsYW5zKTsKICAgIHJldHVybiAwOwp9