1 #include<bits/stdc++.h>
2 using namespace std;
3 #define LL long long
4 #define MAX 100005
5 #define M ((L+R)>>1)
6 const LL inf=10000000000;
7 LL pre[MAX];
8 int total_node=1,root=1;
9 int child[MAX*33][2];
10 LL sum[MAX*33];
11 void irt(LL L,LL R,int id,LL x)
12 {
13 sum[id]++;
14 if(L==R){return;}
15 if(x<=M){
16 if(child[id][0]==0) child[id][0]=++total_node;
17 irt(L,M,child[id][0],x);
18 }
19 else{
20 if(child[id][1]==0) child[id][1]=++total_node;
21 irt(M+1,R,child[id][1],x);
22 }
23 }
24 LL ask(LL L,LL R,int id,LL l,LL r)
25 {
26 if(L>=l&&R<=r) return sum[id];
27 LL s=0;
28 if(l<=M&&child[id][0]) s+=ask(L,M,child[id][0],l,r);
29 if(r>M&&child[id][1]) s+=ask(M+1,R,child[id][1],l,r);
30 return s;
31 }
32 int main()
33 {
34 freopen("in.txt","r",stdin);
35 int N,m,i,j,k;
36 LL Li,Ri,ai;
37 scanf("%d%lld%lld",&N,&Li,&Ri);
38 for(i=1;i<=N;++i){
39 scanf("%lld",&ai);
40 pre[i]=pre[i-1]+ai;
41 }
42 LL ans=0;
43 irt(-inf,inf,root,0);
44 for(i=1;i<=N;++i)
45 {
46 ans+=ask(-inf,inf,root,pre[i]-Ri,pre[i]-Li);;
47 irt(-inf,inf,root,pre[i]);
48 }
49 cout<<ans<<endl;
50 return 0;
51 }