#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
    set<int> x;
    int n;
    int *a;
    cin>>n;
    a = new int [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++)
        x.insert(abs(a[i]-a[j]));
        //cout<<a[i]/2<<" ";
    }
    cout<<x.size()<<endl;
}
return 0;
}
