#include<bits/stdc++.h>
#define maxn 500010
#define N 2000000
#define ll long long
#define mod 1000000007
using namespace std;
int val[maxn], sum[maxn], f[maxn], res[2][N], nxt[maxn], h[N];
int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &val[i]);
		val[i] ^= val[i - 1];
	}
	for (int i = n; i >= 1; i--)
	{
		nxt[i] = h[val[i]];
		h[val[i]] = i;
	}
	for (int i = 1; i <= n; i++)
		sum[i] = sum[i - 1] + (val[i] == 0);
	for (int i = n; i >= 1; i--)
	{
		if (val[i] == 0) continue;
		if (nxt[i] == 0)
		{
			if (val[n] == 0) f[i] = 1;
			else if (i == n) f[i] = 1;
		}
		else
		{
			f[i] = (res[1][val[i]] - (ll)res[0][val[i]] * sum[i] % mod + mod) % mod;
			if (val[n] == 0) f[i] = (f[i] + 1) % mod;
		}
		res[0][val[i]] = (res[0][val[i]] + f[i]) % mod;
		res[1][val[i]] = (res[1][val[i]] + (ll)f[i] * sum[i] % mod) % mod;
	}
	int res = 0;
	for (int i = 1; i <= n; i++)
		res = (res + f[i]) % mod;
	if (val[n] == 0)
	{
		int tmp = sum[n - 1], cur = 1;
		for (int i = 1; i <= tmp; i++)
			cur = (ll)cur * 2 % mod;
		res = (res + cur) % mod;
	}
	printf("%d\n", res);
	return 0;
}