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

int N, M, trees[50];

int calculate_areas (int n) {
    set<int> areas;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            areas.insert(trees[j]-trees[i]);
        }
    }

    return areas.size();
}

int main () {
    cin >> N;
    vector<int> ans;
    for (int i = 0; i < N; i++) {
        cin >> M;
        memset(trees, 0, sizeof(trees));
        for (int i = 0; i < M; i++) {
            cin >> trees[i];
        }
        sort(trees, trees + M);
        cout << calculate_areas(M) << endl;
    }
} 