#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#define MOD 1000000007
using namespace std;
typedef long long ll;

template <typename Tp> inline void getint(Tp &num){
	register int ch, neg = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') neg = 1;
	num = ch & 15;
	while(isdigit(ch = getchar())) num = num * 10 + (ch & 15);
	if(neg) num = -num;
}

inline int fastpow(int bas, int ex){
	register int res = 1;
	for(; ex; ex >>= 1, bas = bas * (ll)bas % MOD) if(ex & 1) res = res * (ll)bas % MOD;
	return res;
}

inline int kazu(int a, const int &b) {return (a += b) >= MOD ? a - MOD : a;}
inline int hiku(int a, const int &b) {return (a -= b) < 0 ? a + MOD : a;}

int N, A = 0, a[500005], sum0[500005], ans = 0;
int nxt[1 << 20], head[1 << 20], id[500005], top, cnt0[1000005], f[1000005][2];

inline int calc_even(const int &x){
	if(head[x] > N) return 0; id[top = 1] = head[x];
	while(nxt[id[top]] <= N) id[top + 1] = nxt[id[top]], top++;
	register int M = 0;
	for(register int i = 1; i <= top; i++){
		cnt0[++M] = -1;
		if(i < top) cnt0[++M] = sum0[id[i + 1]] - sum0[id[i]];
	}
	f[0][0] = 1, f[0][1] = 0;
	for(register int i = 1; i <= M; i++){
		if(cnt0[i] == -1) f[i][0] = f[i - 1][0], f[i][1] = kazu(f[i - 1][1], f[i - 1][0]);
		else f[i][1] = f[i - 1][1], f[i][0] = kazu(f[i - 1][0], f[i - 1][1] * (ll)cnt0[i] % MOD);
	}
	return f[M][1];
}

inline int calc_odd(const int &x){
	if(head[x] > N) return 0; id[top = 1] = head[x];
	while(nxt[id[top]] <= N) id[top + 1] = nxt[id[top]], top++;
	register int M = 0;
	for(register int i = 1; i < top; i++){
		cnt0[++M] = -1;
		cnt0[++M] = sum0[id[i + 1]] - sum0[id[i]];
	}
	f[0][0] = 1, f[0][1] = 0;
	for(register int i = 1; i <= M; i++){
		if(cnt0[i] == -1) f[i][0] = f[i - 1][0], f[i][1] = kazu(f[i - 1][1], f[i - 1][0]);
		else f[i][1] = f[i - 1][1], f[i][0] = kazu(f[i - 1][0], f[i - 1][1] * (ll)cnt0[i] % MOD);
	}
	return f[M][0];
}

int main(){
	getint(N);
	for(register int i = 1; i <= N; i++) getint(a[i]), A = max(A, a[i] ^= a[i - 1]);
	for(register int i = 1; i <= N; i++) sum0[i] = sum0[i - 1] + (a[i] == 0);
	for(register int i = 0; i <= A; i++) head[i] = N + 1;
	for(register int i = N; i; i--) nxt[i] = head[a[i]], head[a[i]] = i;
	if(a[N]) ans = calc_odd(a[N]);
	else{
		ans = fastpow(2, sum0[N] - 1);
		for(register int i = 1; i <= A; i++) ans = kazu(ans, calc_even(i));
	}
	return printf("%d\n", ans), 0;
}
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()

#define cMOD 1000000007ll
constexpr int cN = ( 1 << 20 ) + 1;
ll pool0[cN];
ll pool1[cN];
ll poolCount[cN];

ll fib( ll a )
{
	ll b = 1; ll c = 1;
	REP( i, a - 2 )
	{
		ll d = c;
		c = ( c + b ) % cMOD;
		b = d;
	}
	return c;
}

template <typename T>
T mod_pow(T x, T n, T mod)
{
	T res = 1;
	while (n > 0)
	{
		if (n & 1)
			res = (res * x) % mod;
		x = (x * x) % mod;
		n >>= 1;
	}
	return res;
}

int main()
{
	memset( pool0, 0, sizeof( pool0 ) );
	memset( pool1, 0, sizeof( pool1 ) );
	memset( poolCount, 0, sizeof( poolCount ) );
	
	ll n;
	cin >> n;
	vector<ll> v(n,0);

	ll sum = 0;
	REP(i,n)
	{
		cin >> v[i];
		sum ^= v[i];
	}

	ll left = 0;
	ll count = 0;
	REP(i,cN) pool0[i] = 1;
	REP(i,n)
	{
		left ^= v[i];
		if( left == 0 ) ++count;
		else
		{
			pool0[left] = ( pool0[left] + pool1[left] * ( count - poolCount[left] ) ) % cMOD;
			poolCount[left] = count;
			pool1[left] = ( pool1[left] + pool0[left] ) % cMOD;
		}
	}

	ll ans = 0;
	if( sum == 0 )
	{
		ans = mod_pow( 2ll, count - 1, cMOD );
		REP(i, cN)
		{
			if( i == 0 ) continue;
			ans = ( ans + pool1[i] ) % cMOD;
		}
	}
	else
	{
		ans = pool0[sum];
	}
	
	cout << ans << endl;

	return 0;
}