#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree < int, null_type, less < int > , rb_tree_tag, tree_order_statistics_node_update >
#define ll long long int
#define lld long double
#define srt(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())
#define rep(i, n) for (int i = 0; i < n; i++)
#define yes cout << "YES\n";
#define no cout << "NO\n";
#define nn cout << "\n";
const int N = 2e5 + 5;
const int MOD = 1000000007;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll t = 1;
cin >> t;
while (t--) {
ll n;
cin>>n;
ll a,ans=0,p[n];
cin>>p[0];
for(int i=1;i<n;i++){
cin>>a;
p[i]=a^p[i-1];
if(p[i]==0)ans+=i;
}
if(p[n-1]!=0)ans=0;
cout<<ans<<"\n";
}
return 0;
}
// BS,PS,BM,P2,P,BA,FO