#include <stdio.h>
#include <algorithm>
using namespace std;
using ll = long long;

int n, a[500010], ca[500010];
ll czero[500010], dp[1 << 20][2], last[1 << 20], mod = 1e9+7;
void zero() {
	for (int i = 0; i < (1 << 20); i++)
		dp[i][0] = 1, last[i] = 0;
	for (int i = 1; i <= n; i++) {
		czero[i] = czero[i - 1];
		if (ca[i] != 0) {
			dp[ca[i]][0] += dp[ca[i]][1] * (czero[i] - czero[last[ca[i]]]);
			dp[ca[i]][0] %= mod;

			dp[ca[i]][1] += dp[ca[i]][0];
			dp[ca[i]][1] %= mod;

			last[ca[i]] = i;
		}
		else
			czero[i]++;
	}
	ll sum = 0;
	for (int i = 1; i < (1 << 20); i++)
		sum += dp[i][1];
	ll pow2 = 1;
	for (int i = 0; i < czero[n] - 1; i++)
		pow2 = (pow2 * 2) % mod;
	sum += pow2;
	sum = ((sum % mod) + mod) % mod;
	printf("%lld\n", sum);
}
void nonzero() {
	for (int i = 0; i < (1 << 20); i++)
		dp[i][0] = 1, last[i] = 0;
	for (int i = 1; i <= n; i++) {
		czero[i] = czero[i - 1];
		if (ca[i] != 0) {
			dp[ca[i]][0] += dp[ca[i]][1] * (czero[i] - czero[last[ca[i]]]);
			dp[ca[i]][0] %= mod;

			dp[ca[i]][1] += dp[ca[i]][0];
			dp[ca[i]][1] %= mod;

			last[ca[i]] = i;
		}
		else
			czero[i]++;
	}
	printf("%lld\n", dp[ca[n]][0]);
}
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d", a + i);
		ca[i] ^= ca[i - 1] ^ a[i];
	}

	if (ca[n] == 0)
		zero();
	else
		nonzero();
}
#include <bits/stdc++.h>
using namespace std;

typedef long long lli;

lli rec(int l, int r, vector<int> &A) {
  if(r-l <= 1) return 0;
  int m = (l+r)/2;
  lli res = rec(l, m, A) + rec(m, r, A);
  queue<int> a, b;
  for(int i = l; i < m; ++i) a.push(A[i]);
  for(int i = m; i < r; ++i) b.push(A[i]);
  int k = l;
  while(a.size() && b.size()) {
    if(a.front() <= b.front()) {
      A[k++] = a.front();
      a.pop();
    } else {
      A[k++] = b.front();
      b.pop();
      res += a.size();
    }
  }
  while(a.size()) {
    A[k++] = a.front();
    a.pop();
  }
  while(b.size()) {
    A[k++] = b.front();
    b.pop();
  }
  return res;
}

int main() {
  int n;
  vector<int> A;
  cin >> n;
  A.resize(n);
  for(int i = 0; i < n; ++i) cin >> A[i];
  cout << rec(0, n, A) << endl;
  return 0;
}