#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <functional>
using namespace std;

typedef long long ll;

const int MAXN = 1005;
const double EPS = 1e-8;
const int INF = 1e9+7;

int s[MAXN];
set<int> st;

int main(){
	int t;
	scanf("%d", &t);
	while(t--){
		int n; scanf("%d", &n);
		st.clear();
		for (int i = 0; i < n;i++){
			scanf("%d", &s[i]);
		}
		for (int i = 0; i < n;i++){
			for (int j = i + 1; j < n;j++){
				st.insert(s[j] - s[i]);
			}
		}
		printf("%d\n",st.size());
	}
	return 0;
}

 	 	 					 			  	      		 	   	