#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define LL long long
#define st first
#define nd second
#define endl '\n'
using namespace std;

const int MAXN = 500005, MAXM = (1 << 20), mod = 1000000007;
int a[MAXN], n, x, dp[MAXM][2], lazy[MAXM], sett, y, ans;

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	for(int i = 1; i <= n; ++i) {
		cin >> a[i];
		x ^= a[i];
	}
	for(int i = 1; i < n; ++i) {
		y ^= a[i];
		if(y == 0) {
			++sett;
			dp[y][0] *= 2;
			++dp[y][0];
			dp[y][0] %= mod;
			lazy[y] = sett;
		}
		else {
			if(lazy[y] < sett) {
				dp[y][0] += (1LL * dp[y][1] * (sett - lazy[y])) % mod;
				dp[y][0] %= mod;
				lazy[y] = sett;
			}
			dp[y][1] += dp[y][0] + 1;
			dp[y][1] %= mod;
		}
	}
	for(int i = 0; i < MAXM; ++i) {
		dp[i][0] += (1LL * dp[i][1] * (sett - lazy[i])) % mod;
		dp[i][0] %= mod;		
	}
	if(x == 0) {
		for(int i = 0; i < MAXM; ++i) {
			ans += dp[i][1];
			ans %= mod;
		}
		ans += dp[0][0] + 1;
		ans %= mod;
	}
	else {
		ans = dp[x][0] + 1;
		ans %= mod;
	}
	cout << ans << endl;

}
