#include <bits/stdc++.h>

using namespace std;
#define ll long long int
#define vll vector <ll>
#define pb push_back
int main()
{
    ll t;
    cin >> t;
    while(t--){
   ll n;
   cin >> n;
   ll a[n+1],i,h[52]={0},count=0,j;
   vll v;
   for(i=0;i<n;i++)
   {
       cin >> a[i];
   }
   for(i=0;i<n;i++)
   {
       for(j=i+1;j<n;j++)
       {
           v.pb(abs(a[i]-a[j]));
       }
   }
   for(i=0;i<v.size();i++)
   {
       h[v[i]]++;
   }
   for(i=0;i<51;i++)
   {
       if(h[i]>0)
       {
           count++;
       }
   }
   cout << count << endl;
}
}