#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

const int MAX_N = 1e5 + 5;
int a[MAX_N],vis[MAX_N];

void solve(){
    int n;
    cin >> n;
    memset(vis,0,sizeof vis);
    a[0] = 0;
    for(int i = 1;i <= n;i++){
        cin >> a[i];
    }
    long long res = 0;
//    cout << "test\n\n";
    for(int i = 1;i < n;i++){
        for(int j = i + 1;j <= n;j++){
            if(vis[a[j] - a[i]] == 0){
                res++;
//                cout << j << " " << i << endl;
//                cout << a[j] - a[i] << " " << endl;
                vis[a[j]-a[i]] = 1;
            }
        }
    }
    cout << res << endl;
}

int main(){
    int t = 1;
    cin >> t;
    while (t--)
        solve();
    return 0;
}