#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define N 1000000
#define M 998244353
int i,j,k,n,m,t,a[N+50],p[N+50];
ll t1,t0,f11[2],tot;
map<ll,ll> f;
int main(){
ios::sync_with_stdio(0); cin.tie(0);
cin>>t;
while(t--){
cin>>n;
for(i=1;i<=n;i++){
cin>>a[i];
}
reverse(a+1,a+n+1);
for(i=1;i<=n;i++){
p[i]=(a[i]^p[i-1]);
}
f={}; f[0]=1; f11[0]=f11[1]=0; tot=1;
for(i=1;i<=n;i++){
if(a[i]==1)swap(f11[0],f11[1]);
else f11[0]=f11[1]=0;
t0=(f[p[i]]+f11[1]+M-f11[0])%M;
t1=(tot+M-t0)%M;
f[p[i]]=(f[p[i]]+t0+t1)%M;
f11[0]=(f11[0]+t1)%M;
tot=tot*2%M;
}
cout<<t1<<'\n';
}
}