#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

#define fi first
#define se second
#define mp make_pair
#define eb emplace_back
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for(__typeof(b) i = (a); i < (b); ++i)
#define FORU(i, a, b) for(__typeof(b) i = (a); i <= (b); ++i)
#define FORD(i, a, b) for(__typeof(b) i = (a); i >= (b); --i)

#define Fast_IO ios_base::sync_with_stdio(false); cin.tie(0);
#define PROB "A"
void FI(){
    if(fopen(PROB".inp", "r")){
        freopen(PROB".inp", "r", stdin);
        freopen(PROB".out", "w", stdout);
    }
}

const int N = 50 + 1;
int a[N], n;

set<int> st;

int cal(int x, int y){
    return (y - x);
}

void solve(){
    cin >> n;
    st.clear();
    FORU(i, 1, n) cin >> a[i];
    FORU(i, 1, n) FORU(j, i + 1, n){
        st.insert(cal(a[i], a[j]));
    }
    cout << st.size() << "\n";
}

int main(){
    Fast_IO;
    FI();
    int t; cin >> t;
    while(t--) solve();
    return 0;
}


