#include<bits/stdc++.h>
#include<stdio.h>
#include<vector>
using namespace std;
typedef unsigned long long int ll;

ll findPairsmax(ll arr[],ll n,ll x)
{
    ll l = 0, r = n-1;
    ll result = 0;
 
    while (l < r)
    {
        
        if (arr[l] + arr[r] < x)
        {
            result += (r - l);
            l++;
        }
 
        
        else
            r--;
    }
 
    return result;
}

ll findPairsmin(ll arr[],ll n,ll x)
{
    ll l = 0, r = n-1;
    ll result = 0;
 
    while (l < r)
    {
        
        if (arr[l] + arr[r] > x)
        {
            result += (r - l);
            l++;
        }
 
        
        else
            r--;
    }
 
    return result;
}


int main()
{
   
  int T;
  ll n,l,r,n1,n2,ans;
  cin>>T;
  

  for(int t=0;t<T;t++)
  {
      cin>>n>>l>>r;
      
      ll *A=new ll[n];

      for(ll i=0;i<n;i++)
      {
            cin>>A[i];
           
      }


      sort(A, A+n);
       
      n1=findPairsmax(A,n,l);

     


  

      sort(A,A+n, greater<ll>());
    
      n2=findPairsmin(A,n,r);

      
      ans=(n*(n-1))/2-n1-n2;

      cout<<ans<<endl;

     






  }


}





