#include <bits/stdc++.h>


/////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////AKASH YADAV//////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////



using namespace std;
 
#define ll                long long
#define int               long long
#define ld                long double
#define ff                first
#define ss                second
#define pb                push_back
#define mp                make_pair
#define pll               pair<ll,ll>
#define vi                vector<int>
#define mii               map<int,int>
#define pqb               priority_queue<int>
#define pqs               priority_queue<int, vector<int>, greater<int>>
#define setbits(x)        __buildin_popcountll(x)
#define mod               1000000007
#define inf               1e18
#define ps(x,y)           fixed<<setprecision(y)<<x
#define w(t)              int t; cin>>t; while(t--)
#define lcm(x,y)          (x*y)/__gcd(x,y)
#define gcd(x,y)          __gcd(x,y)
 
 
#ifndef ONLINE_JUDGE
#endif
 
 
string Y = "YES\n";
string N = "NO\n";
 
 
/*
    abs(x-y) will give the absolute difference between two numbers
    __gcd(a,b) will give the gcd of two numbers
    max({a,b,c,d}) will give the maximum number amongst specified numbers
    round(a) will round the number to nearest integer value
    sqrt(x) will give square root of x but it gives output in double
    cbrt(x) will give cube root of x but it gives output in double
    lower_bound(vec.begin(),vec.end(),a) will give the index of the first element in specified range which is just smaller than specified number.
*/


signed main(){
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
 
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        int q;
        cin>>q;
        vi v={};
        int flag = 0;
        set<int, greater<int> > res;

        for (int j = 0; j < q; j++)
        {
            int el;
            cin>>el;
           
            if (flag > 0)
            {
                for (int k = 0; k < v.size(); k++)
                {
                    res.insert(el-v[k]);
                }
                
            }
            v.pb(el);
            flag = 1;
            

            
            

        }
        cout<<res.size()<<endl;
        
    }
    
    
    return 0;
}