#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

struct node{
	int data;
	node *l, *r;
};

node *new_node(int in){
	node *ret = new node;
	ret->data = in;
	ret->l = NULL;
	ret->r = NULL;
	return ret;
}

void insert_node(node **root, int in){
	node *add = new_node(in);
	if(*root == NULL){
		*root = add;
		return ;
	}
	node *p = *root, *pp = NULL;
	while(p != NULL){
		pp = p;
		if(add->data < p->data) p = p->l;
		else p = p->r;
	}
	if(add->data < pp->data) pp->l = add;
	else pp->r = add;
	return ;
}

void print_n(node *root, bool mode){
	if(mode == true) cout << " " << root->data;
	if(root->l != NULL) print_n(root->l, mode);
	if(mode == false) cout << " " << root->data;
	if(root->r != NULL) print_n(root->r, mode);
}

void print_node(node *root){
	print_n(root, false);
	cout << endl;
	print_n(root, true);
	cout << endl;
}

void find_node(node *root, int in){
	bool ans = false;
	while(root != NULL){
		if(in == root->data){
			ans = true;
			break;
		}else if(in < root->data){
			root = root->l;
		}else{
			root = root->r;
		}
	}
	if(ans == false) cout << "no" << endl;
	else cout << "yes" << endl;
}

void delete_node(node **root, int in){
	node *p = *root, *pp = NULL;
	while(p != NULL){
		if(p->data == in) break;
		pp = p;
		if(in < p->data) p = p->l;
		else p = p->r;
	}
	if(p->l == NULL && p->r == NULL){
		if(in < pp->data) pp->l = NULL;
		else pp->r = NULL;
		delete p;
		return ;
	}
	if(p->l == NULL){
		if(in < pp->data) pp->l = p->r;
		else pp->r = p->r;
		delete p;
		return;
	}
	if(p->r == NULL){
		if(in < pp->data) pp->l = p->l;
		else pp->r = p->l;
		delete p;
		return;
	}
	node *rl = p->r, *prl = p;
	while(rl->l != NULL){
		prl = rl;
		rl = rl->l;
	}
	if(in < pp->data) pp->l = rl;
	else pp->r = rl;
	if(prl != p)prl->l = rl->r;
	else prl->r = rl->r;
	rl->l = p->l;
	rl->r = p->r;
	delete p;
}

int main(){
	int n;
	cin >> n;
	node *root = NULL;
	rep(i, n){
		string s;
		cin >> s;
		if(s == "print"){
			print_node(root);
		}else if(s == "find"){
			int in;
			cin >> in;
			find_node(root, in);
		}else if(s == "delete"){
			int in;
			cin >> in;
			delete_node(&root, in);
		}else{
			int in;
			cin >> in;
			insert_node(&root, in);
		}
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1ll<<59

ll modinv(ll a) {
    ll m=Mod;
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}



int main(){
  ll i,j;
  ll n;
  cin>>n;
  ll a[n];
  for(i=0;i<n;i++) cin>>a[i];
  ll sum=0;
  for(i=0;i<n;i++){
      sum=sum^a[i];
  }


      ll tmp=0;
      ll z=1;
      ll q=modinv(2);
      vector<ll> v0(1<<20,1),v1(1<<20,0);
      vector<ll> vz(1<<20,0);

      for(i=0;i<n;i++){
          tmp=tmp^a[i];
          if(tmp==0){
              z++;
              q*=2;
              q%=Mod;
          }
          else {
              v0[tmp]+=v1[tmp]*(z-vz[tmp]);
              v0[tmp]%=Mod;
              v1[tmp]+=v0[tmp];
              v1[tmp]%=Mod;
              vz[tmp]=z;

          }
      }

      if(sum!=0) {
          cout<<v0[sum]<<endl;
      }

      else {
          ll ans=0;
          for(i=0;i<(1<<20);i++) ans+=v1[i];
          cout<<(ans+q)%Mod<<endl;
      }
     

  return 0;
}