#include<bits/stdc++.h>
#define MOD 1000000007
#define PI 3.1415926535897932384626
#define pb push_back
#define bs binary_search
#define eb emplace_back
#define ef emplace_front
#define it iterator
#define us unordered_set
#define deb(x) cout<<#x<<"="<<x<<endl
#define deb2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long  ll;
typedef unsigned long long int ull;
 using namespace std;
 void solve(){
 	ll n;
 	cin>>n;
 	ll a[n];
 	for(ll i=0;i<n;i++){
 		cin>>a[i];
	 }
	 sort(a,a+n);
	 set<ll>b;
	 for(ll i=0;i<n;i++){
	for(ll j=i;j<n;j++){
		ll diff=a[j]-a[i];
		b.insert(diff);
	}
	 }
	 cout<<b.size()-1<<endl;
 	return ;
}
 int main(){
 	ll t;
 	cin>>t;
 	while(t--){
 	solve();}
 	return 0;
 }
