#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod;
#define N 500010
#define M 2000010
ll n,a[N],c[N],cs[N];
ll sum(ll l,ll r){
  return cs[r+1]-cs[l];
}
vector<ll> v[M];
ll f[N],g[N];
void solve(ll k){
  ll m=v[k].size();
  for(int i=0;i<=m;i++)f[i]=g[i]=0;
  g[0]=1;
  ll bef=0;
  for(int i=0;i<m;i++){
    mad(f[i+1],f[i]*(1+sum(bef,v[k][i]))); mad(g[i+1],f[i]*sum(bef,v[k][i]));
    mad(f[i+1],g[i]); mad(g[i+1],g[i]);
    bef=v[k][i];
  }
  if(k==-1){
    for(int i=0;i<=m;i++)cout<<f[i]<<" ";cout<<endl;
    for(int i=0;i<=m;i++)cout<<g[i]<<" ";cout<<endl;
  }
}
ll po(ll x,ll y){
  ll res=1;
  for(;y;y>>=1){
    if(y&1)res=res*x%mod;
    x=x*x%mod;
  }
  return res;
}
int main(){
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    c[0]=0;
    for(int i=0;i<n;i++)c[i+1]=c[i] xor a[i];
    for(int i=0;i<=n;i++){
      v[c[i]].push_back(i);
    }
    for(int i=0;i<=n+1;i++)cs[i]=0;
    for(int i=0;i<v[0].size();i++){
      cs[v[0][i]+1]++;
    }
    //for(int i=0;i<=n;i++)cout<<c[i]<<" ";cout<<endl;
    for(int i=0;i<=n+1;i++)cs[i]+=cs[i-1];
    if(c[n]==0){
      ll ans=0;
      for(int k=1;k<M;k++){
	if(v[k].size()==0)continue;
	solve(k);
	//cout<<k<<":"<<f[v[k].size()]<<endl;
	mad(ans,f[v[k].size()]);
      }
      mad(ans,po(2,v[0].size()-2));
      ans%=mod; if(ans<0)ans+=mod;
      cout<<ans<<endl;
    }
    else{
      v[c[n]].pop_back();
      solve(c[n]); 
      ll ans=g[v[c[n]].size()];
      if(v[c[n]].size()>0){
	ll bef=v[c[n]].back();
	mad(ans,f[v[c[n]].size()]*sum(bef,n));
      }
      ans%=mod; if(ans<0)ans+=mod;
      cout<<ans<<endl;
    }
    return 0;
}
