#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

const int N = 1<<20|3, mod = 1e9+7;
int n,maxn,a[N],pre[N],s[N],s2[N],f[N];
poly v[N];

inline int Mod(int x){
	return x>=mod?x-mod:x;
}

int main(){
	n=read(),pre[0]=1;
	For(i,1,n){
		a[i]=read(),a[i]=a[i-1]^a[i],v[a[i]].pb(i);
		pre[i]=pre[i-1]+(a[i]==0);
	}
	int ans=0;
	if (a[n]==0){
		int x=1;
		For(i,1,pre[n]-2) x=x*2%mod;
		ans=Mod(ans+x);
	}
	FOR(i,1,1<<20) if (!v[i].empty()){
		f[0]=1,s[0]=1,s2[0]=pre[v[i][0]];
		FOR(j,1,siz(v[i])){
			f[j]=(1ll*s[j-1]*pre[v[i][j]]+mod-s2[j-1]+1)%mod;
			s[j]=Mod(s[j-1]+f[j]),s2[j]=(s2[j-1]+1ll*f[j]*pre[v[i][j]])%mod;
		}
		if (a[n]==0) ans=Mod(ans+s[siz(v[i])-1]);
		else if (a[n]==i) ans=Mod(ans+f[siz(v[i])-1]);
	}
	printf("%d\n",ans);
}
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <float.h>
#include <random>

#define repeat(i,n) for (int i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n'
#define debugArrayP(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge].first<< " " << x[hoge].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = LLONG_MAX/10;
const ll MOD = 1e9+7;

ll mod_pow(ll x,int n){
  return n? n&1? x*mod_pow(x,n-1)%MOD:mod_pow(x*x%MOD,n/2):1;
}

int N;
ll dp[(1<<20)+10],dpsum[(1<<20)+10],dpsum2[(1<<20)+10];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>N;
  vint A(N);
  repeat(i,N)cin>>A[i];
  int c=0;
  int xorsum=0;
  repeat(i,N){
    c++;
    int j=i+1;
    xorsum=A[i];
    while(j<N&&xorsum!=0){
      dp[xorsum] = (1+dpsum[xorsum]*c-dpsum2[xorsum]+MOD)%MOD;
      dpsum[xorsum] = (dpsum[xorsum]+dp[xorsum])%MOD;
      dpsum2[xorsum] = (dpsum2[xorsum]+dp[xorsum]*c)%MOD;
      xorsum ^= A[j];
      j++;
    }
    i=j-1;
  }
  ll ans = 0;
  if(xorsum){
    ans = (1+dpsum[xorsum]*c-dpsum2[xorsum]+MOD)%MOD;
  }else{
    ans = mod_pow(2,c-1);
    repeat(i,1<<20){
      ans = (ans+dpsum[i])%MOD;
    }
  }
  cout<<ans<<endl;
  return 0;
}
