#include "bits/stdc++.h"
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
const int MOD=1000000007;
#define endl "\n"
#define fst first
#define snd second
const int UNDEF = -1;
const int INF=1<<30;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;typedef vector<ll> vll;typedef pair<int,int> pii;typedef vector<int> vi;typedef vector<vi> vvi;
#ifdef ONLINE_JUDGE
#define assert(...) /* nothing */
#endif
#define DEBUG_CAT
#ifdef DEBUG_CAT
#define dbg(...)   printf( __VA_ARGS__ )
#else 
#define dbg(...)   /****nothing****/
#endif
int rint();char rch();long long rlong();
// mt19937 rng; rng.seed(std::chrono::high_resolution_clock::now().time_since_epoch().count());
// template<typename T> int bins(vector<T> &v, T key) {int imin=0,imax=v.size();while(imin<imax) {int imid=(imin+imax)>>1;if (v[imid]<key) imin=imid+1;else imax=imid;}return imin;}

struct mint {
  unsigned x;
  inline int _norm(int x) {
    if (x<0) x+=MOD;
    return x;
  }
  mint() : x(0) {}
  mint(signed sig) {sig=_norm(sig); x=sig;}
  mint(signed long long sig) {sig=_norm(sig%MOD); x=sig;}
  int get() const { return (int)x; }
 
  mint &operator+=(mint that) { if((x += that.x) >= MOD) x -= MOD; return *this; }
  mint &operator-=(mint that) { if((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
  mint &operator*=(mint that) { x = ((unsigned long long)x * that.x) % MOD; return *this; }
  mint &operator/=(mint that) { return *this *= that.inverse(); }

  mint &operator+=(int that) {that=_norm(that); if((x += that) >= MOD) x -= MOD; return *this; }
  mint &operator-=(int that) {that=_norm(that); if((x += MOD - that) >= MOD) x -= MOD; return *this; }
  mint &operator*=(int that) {that=_norm(that); x = ((unsigned long long)x * that) % MOD; return *this; }
  mint &operator/=(int that) {that=_norm(that); return *this *= mint(that).inverse(); }

  mint operator+(mint that) const { return mint(*this) += that; }
  mint operator-(mint that) const { return mint(*this) -= that; }
  mint operator*(mint that) const { return mint(*this) *= that; }
  mint operator/(mint that) const { return mint(*this) /= that; }

  mint operator+(int that) const { return mint(*this) += that; }
  mint operator-(int that) const { return mint(*this) -= that; }
  mint operator*(int that) const { return mint(*this) *= that; }
  mint operator/(int that) const { return mint(*this) /= that; }


  mint inverse() const {
    signed a = x, b = MOD, u = 1, v = 0;
    while(b) {
      signed t = a / b;
      a -= t * b; std::swap(a, b);
      u -= t * v; std::swap(u, v);
    }
    if(u < 0) u += MOD;
    mint res; res.x = (unsigned)u;
    return res;
  }
 
  bool operator==(mint that) const { return x == that.x; }
  bool operator!=(mint that) const { return x != that.x; }
  mint operator-() const { mint t; t.x = x == 0 ? 0 : MOD - x; return t; }
  mint operator^(unsigned long long k) const {
    // 0^0 is 1. k must be taken modulo phi(MOD) (MOD-1 if prime) and NOT MOD itself
    mint a=(*this);
    mint r = 1;
    while(k) {
      if(k & 1) r *= a;
      a *= a;
      k >>= 1;
    }
    return r;
  }
};

const int mn=(5e5)+4;
const int mz=(1<<20)+4;
vi h[mz];
int main() 
{
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n; cin>>n; vi a(n),b(n),czero(n+1); for (int i=0;i<n;i++) cin>>a[i];
  b[0]=a[0]; for (int i=1;i<n;i++) b[i]=b[i-1]^a[i];
  for (int i=0;i<n;i++) {
  	h[b[i]].PB(i);
  }
  for (auto &x:h[0]) {
  	czero[x+1]++;
  }
  for (int i=1;i<=n;i++) czero[i]+=czero[i-1];
  mint ans=0;
	if (b[n-1]==0) ans+=mint(2)^(czero[n]-1);
	else ans=1;
	//printf("init:%d\n",ans.get());
  for (int z=1;z<mz;z++) {
  	if (h[z].size()>0 && (b[n-1]==0||b[n-1]==z)) {
  		//printf("z:%d\n",z);
  		auto &v=h[z];
  		int k=v.size();
  		mint f[2][2]; memset(f,0,sizeof f);
  		int cur=0,nxt=1;
  		f[cur][0]=1;
  		int last=0;
  		for (auto &x:v) {
  			memset(f[nxt],0,sizeof f[nxt]);
  			f[nxt][0]+=f[cur][0];
  			f[nxt][1]+=f[cur][1];
  			
  			int zeros=czero[x+1]-czero[last];
  			f[nxt][0]+=f[cur][1]*zeros;
  			f[nxt][1]+=f[nxt][0];
  			//printf("f0: %d  f1: %d\n",f[nxt][0].get(),f[nxt][1].get());
  			last=x;
  			swap(cur,nxt);
  		}
  		if (b[n-1]==0) ans+=(f[cur][1]);
  		else if (b[n-1]==z) ans+=(f[cur][0]-1);
  		else assert(0);
  	}
  }
  printf("%d\n",ans.get());

}


Measured memory_bytes: 40308