//белый снег
//белый porshe
//белый trash
//в бонге воск
#include <iostream>
#include <locale>
#include <string>
#include <iomanip>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <vector>
#include <stdlib.h>
#include <clocale>
#include <algorithm>
#include <iterator>
#include <list>
#include <set>
#include <cstddef>
#include <cstdio>
#include <stdio.h>
#include <map>
#include <cmath>
#include <functional>
#include <stack>
#include <type_traits>
#include <queue>
#include <memory>
#include <memory.h>	
#include <time.h>
#include <ctime>
#pragma warning(disable:4996)
#pragma optimize("", on)
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimization ("Ofast")
#pragma GCC target ("avx2")
using namespace std;
#define Kirja_ES ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define pb push_back
#define pf push_front
#define irt insert
#define ll long long
#define ull unsigned long long
#define str string
#define vi vector<int>
#define vll vector<ll>
#define si set<int>
#define sll set<ll>
#define msi multiset<int>
#define msll multiset<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define left false
#define right true
void solve()
{
	int n;
	cin >> n;
	vi in1;
	for (int i = 0; i < n; ++i)
	{
		int h;
		cin >> h;
		in1.push_back(h);
	}
	si tp;
	for (int i = 0; i < n; ++i)
		for (int j = i + 1; j < n; ++j)
			tp.irt(in1[i] - in1[j]);
	cout << tp.size() << "\n";
	return;
}
signed main()
{
	Kirja_ES;
	int t;
	cin >> t;
	while (t--)
		solve();
	return 0;
}