#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#include <stack>
 
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 1000000007
#define INFLL 1000000000000000007LL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)

typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD = 1000000007;
//ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
ll dp[114514]={0};
ll sum[114514]={0};

int N;
ll a[514514];
int main(){
	cin>>N;
	ll sum=0;
	rep(i,N){
		cin>>a[i];
		sum=sum^a[i];
	}
	ll temp=0;
	vi  sums,zeros;
	int numzero[514514]={0};
	rep(i,N-1){
		temp=temp^a[i];
		if(temp==sum)sums.pb(i+1);
		if(temp==0){
			zeros.pb(i+1);
			numzero[i+1]=1;
		}
		numzero[i+1]+=numzero[i];
	}
	ll ans;
	//cout<<sum<<endl;
	if(sum==0){
		ans=1;
		rep(i,zeros.size()){
			ans*=2;
			ans%=MOD;
		}//sum = 0のパターン
		map<ll,vi> data;
		temp=0;
		vector<ll> kouho;
		rep(i,N-1){
			temp=temp^a[i];
			if(temp!=0&&data[temp].size()==0)kouho.pb(temp);
			data[temp].pb(i+1);
		}
		
		rep(i,kouho.size()){
			ll x=kouho[i];
			//cout<<x<<endl;
			ll sumx=1;
			ll nowx=1;
			rep(j,data[x].size()-1){
				int bef=data[x][j];
				int af=data[x][j+1];
				nowx=sumx*(numzero[af]-numzero[bef])+nowx;
				nowx%=MOD;
				sumx+=nowx;
				sumx%=MOD;
			}
			ans+=sumx;
			ans%=MOD;
		}
		
	}else{
		int mark[514514]={0};
		rep(i,sums.size()){
			mark[sums[i]]=1;
		}
		rep(i,zeros.size()){
			mark[zeros[i]]=-1;
		}
		ll wasu=0,waze=1;
		rep(i,N+1){
			if(mark[i]==1)wasu+=waze;
			if(mark[i]==-1)waze+=wasu;
			wasu%=MOD;
			waze%=MOD;
		}
		ans=waze;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 43752