 #include<iostream>
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
using namespace std;
 
 bool comp(pair<ll,ll> a,pair<ll,ll> b)
 {
    if(a.second!=b.second)
        return a.second>b.second;
    return a.first<b.first;
 }

int main()
{  
     #ifndef ONLINE_JUDGE
     //for getting input from file input.txt
     freopen("input.txt","r",stdin);
    //for writing output to output.txt
     freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(false); cin.tie(NULL);
  


  ll t;
  cin>>t;
  
  
  while(t--)
  {
   

 ll n,i,j;
 cin>>n;
 ll a[n];
 for(i=0;i<n;i++)
    cin>>a[i];
map<ll,ll> map;

for(i=0;i<n;i++)
{
    for(j=i+1;j<n;j++)
        map[a[j]-a[i]]++;
}
cout<<map.size()<<endl;
   

  } 

}
 
 
 