#include "bits/stdc++.h"
#define int long long
#define rep(x, a, b) for (int x = a; x < b; ++x)
#define mod 1000000007
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int T = 1;
    cin >> T;
    while (T--) {
        int N;
        cin >> N;

        vector<int> Ar(N);

        rep(i, 0, N)
            cin >> Ar.at(i);

        unordered_set<int> diffs;
        rep(i, 0, N-1) {
            rep(j, i+1, N) {
                diffs.insert(Ar.at(j) - Ar.at(i));
            }
        }
        cout << diffs.size() << "\n";
    }
    return 0;
}
/*
8
4
1 2 4 5
3
1 3 5
3
2 6 8
2
1 2
1
50
5
3 4 5 6 8
3
1 25 26
6
1 2 4 8 16 32
*/
