#include "bits/stdc++.h"
#define YES "YES"
#define Yes "Yes"
#define NO "NO"
#define No "No"
#define YESNO OUT(three(solve(),YES,NO))
#define YesNo OUT(three(solve(),Yes,No))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(a);i>=(LL)(b);i--)
#define REP(i,b) FOR(i,zero,b)
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,b-1,zero)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB emplace_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define int long long
#define zero 0LL
#define pb PB
using namespace std;
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
typedef long long LL;
typedef long double ld;
typedef LL ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr, Vpr, greater<pr> > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
int dx[] = { 0,1,0,-1,1,1,-1,-1,0 }, dy[] = { 1,0,-1,0,1,-1,1,-1,0 };
const int SIZE1 = 2e6 + 1000;
const int SIZE2 = 1010;
const int SIZE3 = 188;
const int SIZE = SIZE1;
const LL p = 7 + 1e9;
const LL INF = 1 << 20;
const long double EPS = 1e-7;
ut N, M, K, L, H, W, Q, D, T;
// ut A,B,C,D,E,F,G,H,I,J,O,P,Q,R,T,U;
Vpr edges[SIZE];
int maps[SIZE2][SIZE2];
LL A[SIZE];
LL ruiseki[SIZE];
LL ROOT = 334;
VI B[INF + 100];
LL BIT[SIZE];
void add(int x, int val) {
	while (x <= SIZE) {
		BIT[x] += val;
		x += x & -x;
	}
}
LL sum(int x) {
	LL ans = 0;
	while (x > 0) {
		ans += BIT[x];
		x -= x & -x;
	}
	return ans;
}
LL sum(LL a, LL b) {
	return sum(b) - sum(a - 1);
}
LL solve2(VI v) {
	LL zeros = 1;
	LL ks = 0;
	LL lasts = 0;
	REP(i, v.size()) {

		if (i) zeros += ks * sum(v[i - 1] + 1, v[i]);
		if (v[i] == N) {
			return  zeros % p;
		}
		ks += zeros;
		ks %= p;
		zeros %= p;
	}

	if (ruiseki[N] == 0) return ks;
	return 0;
}
LL solve() {
	cin >> N;
	EFOR(i, 1, N) cin >> A[i];
	EFOR(i, 1, N) ruiseki[i] = ruiseki[i - 1] ^ A[i];
	EFOR(i, 1, N) B[ruiseki[i]].pb(i);
	REP(i, B[0].size()) add(B[0][i], 1);
	LL ans = 0;
	//EFOR(i, 1, N) cout << ruiseki[i] << " ";
	FOR(i, 1, INF) {
		ans += solve2(B[i]);
		ans %= p;
	}
	LL ans2 = 1;
	FOR(i, 1, B[0].size()) ans2 = (ans2 * 2) % p;
	if (ruiseki[N]) ans2--;
	//cout << ans << " " << ans2 << endl;
	if (ruiseki[N] == 0)
		ans += ans2 + p;
	ans %= p;
	assert(ans > 0);
	cout << ans << endl;
	return 0;
}
signed main() {

	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	solve();
	//	cin >> N;
	return 0;
}


Measured memory_bytes: 104176