#include<bits/stdc++.h>
using namespace std;
#define    ld    long double
#define    F     first
#define    S     second
#define   endl   "\n"
#define ll long long
#define fast ios::sync_with_stdio(NULL); cin.tie(0); cout.tie(0);
  const int M = 1e5 + 10 , O = 1e9 +10;
int t;
set< int >s;
    ll n,a[52];
int main()
{
fast
//freopen("string.in","r",stdin);
cin>>t;
while(t--)
{
    s.clear();
    cin>>n;
    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++)
        s.insert(a[j]-a[i]);
    //for( auto ch:s)
   // cout<<ch<<" ";
    cout<<s.size()<<endl;
    }
}


