#include <iostream>
#include <set>
using namespace std;

int a[51];
set<int> q;

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