//二分的复杂度logn,常见和一个n的for循环结合成nlogn'
#include <bits/stdc++.h>
using namespace std;
int n,l,r;
const int N=2e5+3;
int a[N];
long long ans;
int main()
{
// 优化 C++ 输入输出流,防止读入大数据时 TLE
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>n>>l>>r;
for(int i=1;i<=n;i++) cin>>a[i];
sort(a+1,a+1+n);
//l<=ai+aj<<r=>aj>=l-ai&&aj<=r-ai
for(int i=1;i<=n;i++){
// ans+=lower_bound(a+i+1,a+1+n,r-a[i])-lower_bound(a+i+1,a+1+n,l-a[i])+1;找<=时只能用uppper
ans += upper_bound(a + i + 1, a + 1 + n, r - a[i]) - lower_bound(a + i + 1, a + 1 + n, l - a[i]);
}
cout<<ans;
return 0;
}