#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n)cin>>a[i];
    rep(i,n-1)a[i+1]^=a[i];
    ll ans=1;
    vector<ll> ret1(1<<20),ret0(1<<20,1),cnt(1<<20,0);
    ll res=a[n-1];
    int x=0;
    rep(i,n){
        if(a[i]==0){
            ++x;
        }
        else {
            (ret0[a[i]]+=ret1[a[i]]*(x-cnt[a[i]]))%=mod;
            (ret1[a[i]]+=ret0[a[i]])%=mod;
            cnt[a[i]]=x;
        }
    }
    if(res)cout<<ret0[res]<<endl;
    else {
        rep(i,x-1)ans=2*ans%mod;
        rep(i,1<<20){
            ans+=ret1[i];
        }
        cout<<ans%mod<<endl;
    }

    return 0;
}