#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long 
#define ii pair<int,int>
#define iii pair<ii,int>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)/2)
#define all(x) x.begin(),x.end()
#define pw(x) (1<<(x))
#define inf 1000000000
#define MOD 1000000007 
#define N 200005
#define M 1000003
#define MAX 2000000
#define LOG 20
#define KOK 300
#define EPS 0.0000001
using namespace std;

int ans;
int psum[500005];
vector<int> pos[1<<20];

int mul(int x,int y) {
	
	return (ll)x*y%MOD;

}

int add(int x,int y) {

	x+=y;

	if(x>=MOD) x-=MOD;
	if(x<0) x+=MOD;

	return x;

}

void solve(int val,int n) {

	if(val) {

		pos[val].pb(n+1);

		int zero=(sz(pos[val])>1),non=0;

		if(!zero) return ;

		for(int i=0;i<sz(pos[val])-1;i++) {

			non=add(non,zero);

			int inside=psum[pos[val][i+1]-1]-psum[pos[val][i]];

			zero=add(zero,mul(inside,non));

		}

		pos[val].ppb();

		if(pos[val].back()==n) ans=add(ans,zero);
		else ans=add(ans,non);

	}
	else {

		int res=1;

		for(int i=0;i<sz(pos[val])-1;i++) res=add(res,res);

		ans=add(ans,res);

	}

}
	
int main() {

	int n;

	scanf("%d",&n);

	vector<int> pre(n+1,0);

	for(int i=1;i<=n;i++) {

		int x;

		scanf("%d",&x);

		pre[i]=pre[i-1]^x;

		psum[i]=psum[i-1]+(pre[i]==0);

		pos[pre[i]].pb(i);

	}

	if(pre[n]==0) {

		for(int i=0;i<(1<<20);i++) solve(i,n);

	}
	else {

		solve(pre[n],n);

	}

	printf("%d",ans);

} 