#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<set>

typedef long long int ll;

#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#define MIN(x, y) (((x) < (y)) ? (x) : (y))

using namespace std;

int main() {
    int t;
    int n;
    int x[55];

    scanf("%d", &t);

    while(t--) {
        scanf("%d", &n);
        for (int i = 0; i < n; i++) {
            scanf("%d", &x[i]);
        }

        set<double> area;

        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                double a = 0.5 * (x[j] - x[i]) - 0.5;
                area.insert(a);
            }
        }

        printf("%d\n", (int)area.size());
    }
    return 0;
}