import java.util.Arrays;
import java.util.Scanner;
public class Main{
static int N = 2_00_010;
static int [] a = new int [N];
static int n;
//利用双指针,返回a数组中小于等于x的个数
static long calc(int x) {
int l = 1, r = n;
long ans = 0;
while(l < r)
{
while(l < r && a[l] + a[r] > x) {
r --;
}
ans += r - l;
l ++;
}
return ans;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
int l = sc.nextInt();
int r = sc.nextInt();
for(int i = 1; i <= n; i ++) a[i] = sc.nextInt();
Arrays.sort(a, 1, n + 1);
System.out.println(calc(r) - calc(l - 1));
}
}