#include<bits/stdc++.h> 
#define int long long
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define endl "\n"
using namespace std;

const int max_n = 2e5+100;
const int Mod = 998244353;
const int inf = 2e18;

signed main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int T;cin>>T;
	while(T--){
		int n;cin>>n;
		int x[n];
		set<int> S;
		for(int i=0;i<n;i++){
			cin>>x[i];
			for(int j=0;j<i;j++){
				S.insert(x[i]-x[j]);
			}
		}
		cout<<S.size()<<endl;
	}

}