#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back

#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, n) for (int i = 0; i < (int)(n); ++ i)

const int maxn = 5e5 + 5;
const int mx = 1 << 20;
const int mod = 1e9 + 7;

inline void add(int &x, int y) {
	x += y;
	if (x >= mod) x -= mod;
}

inline int qp(int x, int n) {
	int ans = 1;
	for (; n; n >>= 1, x = 1LL * x * x % mod)
		if (n & 1) ans = 1LL * ans * x % mod;
	return ans;
}

int n;
int a[maxn];
vector <int> occ[mx];
int cnt0[maxn];

int main() {
	scanf("%d", &n);
	rep(i, n) scanf("%d", &a[i]);
	rep(i, n) a[i] = (i ? a[i - 1] : 0) ^ a[i];
	rep(i, n) cnt0[i] = (i ? cnt0[i - 1] : 0) + (a[i] == 0);
	rep(i, n) occ[a[i]].pb(i);
	if (!cnt0[n - 1]) { puts("1"); return 0; }
	int ed = a[n - 1], ans = ed == 0 ? qp(2, cnt0[n - 1] - 1) : 0;
	rep(v, mx) if (v && (ed == 0 || ed == v)) {
		if (occ[v].empty()) continue;
		vector <int> dp(occ[v].size());
		int sum0 = 0, sum1 = 0;
		rep(i, occ[v].size()) {
			dp[i] = (1 + 1LL * sum0 * cnt0[occ[v][i]] % mod + mod - sum1) % mod;
			add(sum0, dp[i]);
			add(sum1, 1LL * dp[i] * cnt0[occ[v][i]] % mod);
		}
		add(ans, ed == 0 ? sum0 : dp[occ[v].size() - 1]);
	}
	printf("%d\n", ans);
	return 0;
}
