#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<deque>
#include<string>
#include<cmath>
#include<map>
#include<set>
#define inf 99999999999999999
#define MOD 1000000007
#define endl "\n"
#define ll long long
#define forl(i,a,b) for(ll i=a;i<=b;i++)
#define forx(i,a,b) for(ll i=a;i>=b;i--)

using namespace std;
//---------------------------------------KHAI BAO BIEN----------------------------------------------
typedef pair<long long,long long> ii;
typedef pair<ii,long long> iii;
typedef pair<int,int> pii;
int tdong[5]={0,1,-1,0,0};
int tcot[5]={0,0,0,1,-1};
int tdm[9]={0,-2,-2,-1,-1,1,1,2,2};
int tcm[9]={0,-1,1,-2,2,-2,2,-1,1};
int t,n,m;
string cong( string s1,string s2)
{
    if(s1=="0" && s2=="0")return "0";
    if(s1.length()>s2.length())swap(s1,s2);
    s2="0"+s2;
    while(s1.length()!=s2.length())
    {
        s1="0"+s1;
    }
    int nho=0,nho_1=0;
    forx(i,s1.length()-1,0)
    {
        nho=(bool)(((int)s1[i]-48+(int)s2[i]-48)+nho_1>=10);
        s1[i]=(char)((((int)s1[i]-48+(int)s2[i]-48)+nho_1)%10+48);
        nho_1=nho;
        //cout<<s1<<" "<<s2<<" "<<nho<<endl;
    }

    while(s1[0]=='0')s1.erase(0,1);
    return s1;
}
struct fenwick_tree
{
    int tree[300005];
    void khoi_tao(ll max_n)
    {
        forl(i,0,max_n)tree[i]=0;
    }
    void update(ll to,ll value)
    {
        for(to;to<300004;to+=to&(-to))tree[to]=(tree[to]+value);
    }
    ll tinh_tong(ll to)
    {
        ll kq=0;
        if(to!=0)for(to;to>0;to-=to&(-to))kq=(kq+tree[to])%MOD;
        return kq;
    }
    ll sum(ll from,ll to)
    {
        return (tinh_tong(to)-tinh_tong(from-1))%MOD;
    }
};
//---------------------------------------CHUONG TRINH CON-----------------------------------------------------
struct segment_tree
{
    ll lazy[100005],s_tree[100005];
    void khoi_tao()
    {
        forl(i,1,100004){lazy[i]=0;s_tree[i]=0;}
    }
    void update_range(ll vt,ll r_left,ll r_right,ll t_left,ll t_right,ll value)
    {
        if(lazy[vt]!=0)
        {
            s_tree[vt]+=lazy[vt];
            lazy[vt*2]+=lazy[vt];
            lazy[vt*2+1]+=lazy[vt];
            lazy[vt]=0;
        }
        if(r_left>t_right || t_left>r_right)return;
        else if(r_left<=t_left && r_right>=t_right)
        {
            s_tree[vt]+=value;
            lazy[vt*2]+=value;
            lazy[vt*2+1]+=value;
            return;
        }
        else
        {
            ll mid=(t_left+t_right)/2;
            update_range(vt*2,r_left,r_right,t_left,mid,value);
            update_range(vt*2+1,r_left,r_right,mid+1,t_right,value);
            //max,min
            s_tree[vt]=max(s_tree[vt*2],s_tree[vt*2+1]);
        }
    }
    ll max_range(ll vt,ll r_left,ll r_right,ll t_left,ll t_right )
    {
        if(lazy[vt]!=0)
        {
            s_tree[vt]+=lazy[vt];
            lazy[vt*2]+=lazy[vt];
            lazy[vt*2+1]+=lazy[vt];
            lazy[vt]=0;
        }
        if(r_left>t_right || r_right<t_left)return -inf;
        else if(r_left<=t_left && r_right>=t_right)return s_tree[vt];
        else
        {
            ll mid=(t_left+t_right)/2;
            return max(max_range(vt*2,r_left,r_right,t_left,mid),max_range(vt*2+1,r_left,r_right,mid+1,t_right));
        }
    }
};
ll ucln(ll a,ll b)
{
    if(a==b || a==0 || b==0)return max(a,b);
    if(a>b)return ucln(a%b,b);
    if(a<b)return ucln(a,b%a);
}
ll pow_f(ll a,ll b)
{
    ll kq=1;
    while(b>0)
    {
        if(b&1)kq*=a;
        else a*=a;
        b/=2;
    }
    return kq;
}
short parent[1005];
bool visit[5005];
long long d[5005],table[2005][2005];

int getmin()
{
    ll dd=inf,u=0;
    forl(i,1,n)if(!visit[i] && d[i]<dd){dd=d[i];u=i;}
    return u;
}
void prim(int s)
{
    forl(i,1,n){visit[i]=false;d[i]=inf;}
    d[s]=0;
    while(true)
    {
        int u=getmin();
        //cout<<u<<endl;
        if(u==0)break;
        visit[u]=true;
        forl(i,1,n)
        {
            if(!visit[i])d[i]=min(d[i],table[u][i]);
        }
    }
}
ll distra(int s,int t)
{
    forl(i,1,n){visit[i]=false;d[i]=inf;}
    d[s]=0;
    while(true)
    {
        int u=getmin();
        //cout<<u<<endl;
        if(u==0 || u==t)return d[t];
        visit[u]=true;
        forl(i,1,n)
        {
            if(!visit[i])d[i]=min(d[i],max(table[u][i],d[u]));
        }
    }
}
int find_parent(int a)
{
    if(parent[a]==a)return parent[a];
    else return parent[a]=find_parent(parent[a]);
}
void join(int a,int b)
{
    a=find_parent(a);
    b=find_parent(b);
    parent[b]=a;
}
bool check(int i,int j)
{
    return(i>=1 && j>=1 && i<=n && j<=m);
}
struct edge
{
    ll ii,jj,ww;
    edge(int ii,int jj, int ww)
    {
        this->ii=ii;
        this->jj=jj;
        this->ww=ww;
    }
};
void distra_heap(int s,int t,vector<ii> canh[])
{
    forl(i,1,n){d[i]=inf;visit[i]=false;}
    d[s]=0;
    priority_queue<ii, vector<ii>, greater<ii> > pq;
    pq.push(ii(0,s));
    while(!pq.empty())
    {
        int u=pq.top().second;
        pq.pop();
        if(visit[u])continue;
        visit[u]=true;
        forl(i,0,canh[u].size()-1)
        {
            d[canh[u][i].first]=min(d[canh[u][i].first],d[u]+canh[u][i].second);
            pq.push(ii( d[canh[u][i].first],canh[u][i].first));
        }
    }
}
int a[100005];
int k,p,x,y;
ll sum(int l,int r)
{
    return a[r]-a[max(l-k,0)];
}
//---------------------------------------CHUONG TRINH CHINH--------------------------------------------------

int main()
{
/**/#ifndef ONLINE_JUDGE
   freopen("test.inp","r",stdin);
   freopen("test.out","w",stdout);
#endif // ONLINE_JUDGE
  // ios_base::sync_with_stdio(0);cin.tie(0);//cout.tie(0);

   //cin.ignore();
  // cout<<fixed;
  // cout<<setprecision(3);
   /**/
   int t=1;
    /**/cin>>t;
    int a[205],v[205];
    int n,kq=0;
   while(t--)
   {
       cin>>n;kq=0;
       forl(i,1,n){cin>>a[i];}
       forl(i,1,100)v[i]=0;
       sort(a+1,a+1+n);
       forl(i,1,n-1)
       forl(j,i+1,n)
       {
           if(!v[a[j]-a[i]]){kq++;v[a[j]-a[i]]=true;}
       }
       cout<<kq<<endl;
   }
}
