#include <iostream> 
#include <vector>
#include <cmath>
#include <string>
#include <sstream>
#include <algorithm>
#include <queue>
#include <stack>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <map>
#include <iomanip>
#include <cctype>
#include <climits>

using namespace std;

using vi = vector<int>;
using vvi = vector<vi>;

using ii = pair<int, int>;
using vii = vector<ii>;
using vvii = vector<vii>;

using vb = vector<bool>;

using ll = long long int;

#define mp(a,b) make_pair(a,b)

const int MOD = 1000 * 1000 * 1000 + 7;
const int INF = 1000 * 1000 * 1000;

bool res() {
	int n;
	cin >> n;
	if (!cin) return false;

	set<int> areas;

	vi v(n);
	for (int& x : v) cin >> x;

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

	cout << areas.size() << '\n';

	return true;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int nc;
	cin >> nc;
	for (int i = 0; i < nc; ++i) res();
	return 0;
}