#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define eb emplace_back
#define all(x) begin(x),end(x)
#define all1(x) begin(x)+1,end(x)
#define mp make_pair
#define FAST ios::sync_with_stdio(false);
#define FAST2 cin.tie(NULL);cout.tie(NULL);
#define FOR(i,a,b) for(int (i)=a;(i)<=(b);(i)++)
#define chkmin(x,e) x=min(x,e)
#define chkmax(x,e) x=max(x,e)
ll fp(ll a,int n){
    ll ans=1, tmp=n;
    while (n){
        if (n&1) ans*=tmp;
        tmp*=tmp;
        n>>=1;
    }
    return ans;
}


int a[52];
int s[52];
void solve() {
	int n; cin >> n;
	FOR(i, 1, n) cin >> a[i];
	if (n==1) {
		cout << 0 << endl;
		return;
	}
	FOR(i, 2, n) s[i] = a[i] - a[i-1];
	set<int> ans;
	FOR(i, 2, n) {
		int ts = 0;
		FOR(j, i, n) {
			ts+= s[j];
			ans.insert(ts);
		}
	}
	cout << ans.size() << endl;
}

int main() {
	FAST;FAST2;
	int T = 1;
	cin >> T;
	while(T--) solve();
}
