题目
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static long calc(long[] num,int max) {
int l = 0;
int r = num.length-1;
long res = 0;
while(l<r) {
while(l<r && num[l]+num[r]>max) {
r--;
}
res+=(r-l);
l++;
}
return res;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int l = sc.nextInt();
int r = sc.nextInt();
sc.nextLine();
long[] num = new long[n];
for(int i=0;i<n;i++)
num[i] = sc.nextLong();
Arrays.sort(num);
long res1 = calc(num,r);
long res2 = calc(num,l-1);
System.out.println(res1-res2);
sc.close();
}
}