#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
using ll = long long;
int main() {
FAST;
int tc = 1, ti;
cin >> tc;
for (ti = 1; ti <= tc; ++ti) {
ll n, i, ans, x, l, cnt;
cin >> n;
vector<ll> a(n);
for (i = 0; i < n; ++i) cin >> a[i];
map<ll,pair<ll,ll>> mp;
mp[0] = {0, 1};
x = 0;
ans = 0;
for (i = 0; i < n; ++i) {
x ^= a[i];
if (mp.find(x) != mp.end()) {
tie(l, cnt) = mp[x];
ans += cnt * i - l;
mp[x] = {l+i+1, cnt+1};
} else {
mp[x] = {i+1, 1};
}
}
cout << ans << "\n";
}
return 0;
}