/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;
int main()
{
    //cout<<"Hello World";
    ll t;cin>>t;
    while(t--){
        ll n;cin>>n;ll c=0;
        vector<ll>vis(52,0);
        ll a[n];for(int i=0;i<n;i++)cin>>a[i];
        for(ll i=0;i<n;i++){
            for(ll j=i+1;j<n;j++){
                if(vis[a[j]-a[i]]!=1){
                    vis[a[j]-a[i]]=1;c++;
                }
            }
        }
        cout<<c<<endl;
    }
    return 0;
}
