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

const int M = int(1e9 + 7);

signed main() {
  ios::sync_with_stdio(false);

  int N;
  cin >> N;

  vector<int> A(N);
  for (int i = 0; i < N; ++i) cin >> A[i];

  vector<int> pre(N + 1); {
    for (int i = 0; i < N; ++i) {
      pre[i + 1] = pre[i] ^ A[i];
    }
    if (pre[N]) {
      static int dp[1 << 19][2][2][2];
      dp[1][0][1][1] = 1;
      for (int i = 1; i <= N; ++i) {
        for (int c = 0; c < 2; ++c) {
          if (pre[i] == 0) {
            (dp[i + 1][c][1][1] += dp[i][c][0][0]) %= M;
            (dp[i + 1][c][1][1] += dp[i][c][0][1]) %= M;
          } else if (pre[i] == pre[N]) {
            (dp[i + 1][c ^ 1][0][1] += dp[i][c][1][0]) %= M;
            (dp[i + 1][c ^ 1][0][1] += dp[i][c][1][1]) %= M;
          }
          (dp[i + 1][c][0][0] += dp[i][c][0][0]) %= M;
          (dp[i + 1][c][1][0] += dp[i][c][1][0]) %= M;
          (dp[i + 1][c][0][0] += dp[i][c][0][1]) %= M;
          (dp[i + 1][c][1][0] += dp[i][c][1][1]) %= M;
        }
      }
      int ans = (dp[N + 1][0][0][1] + dp[N + 1][1][0][1]) % M;
      cout << ans << endl;
      return 0;
    }
  }

  vector<int> pz(pre.size() + 1); {
    for (int i = 0; i < pre.size(); ++i) {
      pz[i + 1] = pz[i] + (pre[i] == 0);
    }
  }

  map<int, vector<int>> dp; {
    map<int, int> cnt;
    map<int, int> last;
    for (int i = 0; i < pre.size(); ++i) {
      if (pre[i]) {
        if (last.count(pre[i])) {
          int l = last.count(pre[i]) ? last[pre[i]] : 0;
          int cz = pz[i] - pz[l];
          if (cz) dp[pre[i]].push_back(cz);
        }
        ++cnt[pre[i]];
        last[pre[i]] = i;
      } else {
        for (auto it = cnt.begin(); it != cnt.end(); ++it) {
          dp[it->first].push_back(it->second);
        }
        cnt.clear();
      }
    }
  }

  int ans = 1; {
    for (int i = 1; i + 1 < pre.size(); ++i) {
      if (pre[i] == 0) ans = 2LL * ans % M;
    }
    for (auto it = dp.begin(); it != dp.end(); ++it) {
      auto s = it->second;
      vector<int> dpdp(2);
      dpdp[0] = 1;
      for (int i = 0; i < s.size(); ++i) {
        (dpdp[~i & 1] += 1LL * s[i] * dpdp[i & 1] % M) %= M;
      }
      (ans += dpdp[1]) %= M;
    }
  }

  cout << ans << endl;

  return 0;
}

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=5e5+5;
const int M=(1<<20)+5;
const int p=1e9+7;

int read()
{
	int s=0;
	char c=getchar(),lc='+';
	while (c<'0'||'9'<c) lc=c,c=getchar();
	while ('0'<=c&&c<='9') s=s*10+c-'0',c=getchar();
	return lc=='-'?-s:s;
}
void write(int x)
{
	if (x<0)
	{
		putchar('-');
		x=-x;
	}
	if (x<10) putchar(x+'0');
	else
	{
		write(x/10);
		putchar(x%10+'0');
	}
}
void print(int x,char c='\n')
{
	write(x);
	putchar(c);
}
void add(int &x,int y)
{
	x+=y;
	if (x>=p) x-=p;
}
int sum1[M],sum2[M],dp[N],s[N],x[N];

signed main()
{
	x[0]=s[0]=0;
	memset(sum1,0,sizeof(sum1));
	memset(sum2,0,sizeof(sum2));
	int n=read();
	dp[0]=1;
	sum1[0]=1;
	for (int i=1;i<=n;i++)
	{
		x[i]=x[i-1]^read();
		s[i]=s[i-1]+(x[i]==0);
		dp[i]=((s[i-1]*sum1[x[i]]-sum2[x[i]]+1)%p+p)%p;
		add(sum1[x[i]],dp[i]);
		add(sum2[x[i]],dp[i]*s[i]%p);
	}
	if (x[n]) print(dp[n]);
	else
	{
		int ans=dp[n];
		for (int i=1;i<=n;i++) if (x[i]) add(ans,dp[i]);
		print(ans);
	}

	return 0;
}