#include <bits/stdc++.h>

using namespace std;

const int N = 55;

int T;
int n;
int a[N];

int main() {
	scanf("%d", &T);
	while (T --) {
		scanf("%d", &n);
		for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
		
		set<int> ans;
		for (int i = 0; i < n - 1; ++i) {
			for (int j = i + 1; j < n; ++j) {
				ans.insert(a[j] - a[i]);
			}
		}
		
		printf("%d\n", ans.size());
	}
	
	return 0;
} 
