// #include <iostream> 
// #include <vector>
// #include <utility>

#include <bits/stdc++.h>

using namespace std;

double calculateArea(int n, int m){
    double area=0.5*(m-n)*1;
    
    return area;
}

int main(){
    int t;
    cin>>t;
    
    while(t--){
      
      int n;
      cin>>n;
      int a[n];
      vector<double> v;
      vector<double>::iterator it;
      for(int i=0;i<n;i++){
          cin>>a[i];
      }
      
      for(int i=0;i<n;i++){
          for(int j=i+1;j<n;j++){
              double area=calculateArea(a[i],a[j]);
              v.push_back(area);
            
             
          }
          
      }
   
   set<double> s(v.begin(),v.end());
   v.assign(s.begin(),s.end());
    
    cout<<v.size()<<'\n';
      
         
    }
    
    
    
    
}