// بِسْمِ ٱللَّٰهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ
// اللَّهُمَّ إِنِّي أَسْأَلُكَ عِلْمًا نَافِعًا وَرِزْقًا طَيِّبًا وَعَمَلاً مُتَقَبَّلاً
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define ppb pop_back
#define checkmate return 0
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define for1(i , y) for(ll i = y ; i<n ; i++)
#define for2(i , y) for(ll i = y ; i<m ; i++)
#define vi(n) vector<int> v(n)
#define vll vector<ll>
#define vcin(v) for(ll i = 0; i<n ; i++) cin>>v[i]
#define MOD 1000000007
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define setpr cout<<fixed<<setprecision(1)<< x <<endl
#define vmax *max_element(v.begin(),v.end())
#define vmin *min_element(v.begin(),v.end())
#define fast() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define dbg(...)
// T B L R TL TR BL BR
int dx[10] = {-1 , 1 , 0 , 0 , -1 , -1 , 1 , 1};
int dy[10] = { 0 , 0 ,-1 , 1 , -1 , 1 ,-1 , 1};
// ------------- ----------------
// side move diagonal move
const int N = 1e5 + 7;
int a[1000+5];
using namespace std;
void file(){
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
}
double wasted(pair<double,double>p1 , pair<double,double> p2)
{
return sqrtl((p1.f-p2.f)*(p1.f-p2.f)+(p1.s-p2.s)*(p1.s-p2.s));
}
bool isBalanced(char c1 , char c2){
return (c1 == '(' && c2 == ')' || c1 == '[' && c2 == ']');
}
bool isVowel(char c){
return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');
}
bool isPrime(int n) {
if (n <= 1) return false;
if (n <= 3) return true;
if (n % 2 == 0 || n % 3 == 0) return false;
for (int i = 5; i * i <= n; i += 6) {
if (n % i == 0 || n % (i + 2) == 0) return false;
}
return true;
}
ll sum(ll n){
ll ans = 0;
while(n){
ans += n % 10;
n /= 10;
}
return ans;
}
//---------------- Solution Here ----------------/
void solve(){
int n; cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
}
ll px = 0;
ll ans = 0;
unordered_map<ll, ll> xc;
unordered_map<ll, ll> xs;
xc[0] = 1;
xs[0] = 0;
for (int i = 0; i < n; i++) {
px ^= v[i];
if (xc.find(px) != xc.end()) {
ans += xc[px] * i - xs[px];
}
xc[px]++;
xs[px] += (i + 1);
}
cout << ans << endl;
}
int main()
{
fast();
//file();
ll t ; cin>>t;
//int tt=1;
while(t--)
{
//cout<<"Case "<<tt<<": ";
// tt++;
solve();
}
//solve();
checkmate;
}