#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define int long long 

ll ruijo(ll x,ll n){
	long long p,ans;
	if(n==0)return 1;
	if(n==1)return x;
	if(n%2){
		p = ruijo(x,n/2);
		ans = (x*p)%mod;
		ans = (ans*p)%mod;
		return ans;
	}else{
		p = ruijo(x,n/2);
		ans = (p*p)%mod;
		return ans;
	}
}

signed main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n)cin >> a[i];
    vector<int> s(n);
    vector<vector<int> > st(1<<20);
    rep(i,n){
        if(i==0){
            s[i] = a[i];
        }else{
            s[i] = s[i-1]^a[i];
        }
        st[s[i]].push_back(i);
        //cerr << s[i] << " ";
    }
    //cerr << endl;
    ll res = 0;
    if(s[n-1]==0){
        rep(bit,1<<20){
            if(bit==0){
                int len = st[bit].size();
                res += ruijo(2,len-1);
                res %= mod;
            }else{
                int id = -1;
                vector<int> p;
                bool flag = 1;
                while(1){
                    if(flag){
                        int kid = 0;
                        if(lower_bound(st[bit].begin(),st[bit].end(),id)!=st[bit].end()){
                            kid = *lower_bound(st[bit].begin(),st[bit].end(),id);
                        }else{
                            break;
                        }
                        int zid = 0;
                        if(lower_bound(st[0].begin(),st[0].end(),kid)!=st[0].end()){
                            zid = *lower_bound(st[0].begin(),st[0].end(),kid);  
                        }else{
                            zid = n;
                        }
                        int cnt = lower_bound(st[bit].begin(),st[bit].end(),zid)-lower_bound(st[bit].begin(),st[bit].end(),id);
                        id = kid;
                        p.push_back(cnt);
                        flag = 0;
                    }else{
                        int zid = 0;
                         if(lower_bound(st[0].begin(),st[0].end(),id)!=st[0].end()){
                            zid = *lower_bound(st[0].begin(),st[0].end(),id);
                        }else{
                            break;
                        }
                        int kid = 0;
                        if(lower_bound(st[bit].begin(),st[bit].end(),zid)!=st[bit].end()){
                            kid = *lower_bound(st[bit].begin(),st[bit].end(),zid);  
                        }else{
                            kid = n;
                        }
                        int cnt = lower_bound(st[0].begin(),st[0].end(),kid)-lower_bound(st[0].begin(),st[0].end(),id);
                        
                        id = zid;
                        p.push_back(cnt);
                        flag = 1;
                    }
                }
                // if(p.size()>0){
                //     cout << bit << endl;
                //     for(int x:p){
                //         cout << x << " ";
                //     }
                //     cout << endl;
                // }
                int m = p.size();
                vector<ll > dp(m);
                vector<ll> dp2(m);
                if(m==1){
                    res += p[0];
                    res %= mod;
                }else if(m>1){
                    p[m-1] = 1;
                    rep(i,m){
                        if(i==0){
                            dp[i] = p[i];
                            dp2[i] = p[i];
                        }else if(i==1){
                            dp[i] = dp2[i-1]*p[i]%mod;
                            dp2[i] = dp[i];
                        }else{
                            if(i%2==0){
                                dp[i] = p[i]*(dp2[i-1]+1)%mod; 
                            }else{
                                dp[i] = p[i]*(dp2[i-1])%mod; 
                            }
                            dp2[i] = dp2[i-2]+dp[i];
                            dp2[i]%=mod;
                        }
                    }
                    res += dp[m-1];   
                    res %= mod;
                   
                }
            }
        }
    }else{
        int bit  = s[n-1];
        int id = -1;
        vector<int> p;
        bool flag = 1;
        while(1){
            if(flag){
                int kid = 0;
                if(lower_bound(st[bit].begin(),st[bit].end(),id)!=st[bit].end()){
                    kid = *lower_bound(st[bit].begin(),st[bit].end(),id);
                }else{
                    break;
                }
                int zid = 0;
                if(lower_bound(st[0].begin(),st[0].end(),kid)!=st[0].end()){
                    zid = *lower_bound(st[0].begin(),st[0].end(),kid);  
                }else{
                    zid = n;
                }
                int cnt = lower_bound(st[bit].begin(),st[bit].end(),zid)-lower_bound(st[bit].begin(),st[bit].end(),id);
                id = kid;
                p.push_back(cnt);
                flag = 0;
            }else{
                int zid = 0;
                    if(lower_bound(st[0].begin(),st[0].end(),id)!=st[0].end()){
                    zid = *lower_bound(st[0].begin(),st[0].end(),id);
                }else{
                    break;
                }
                int kid = 0;
                if(lower_bound(st[bit].begin(),st[bit].end(),zid)!=st[bit].end()){
                    kid = *lower_bound(st[bit].begin(),st[bit].end(),zid);  
                }else{
                    kid = n;
                }
                int cnt = lower_bound(st[0].begin(),st[0].end(),kid)-lower_bound(st[0].begin(),st[0].end(),id);
                
                id = zid;
                p.push_back(cnt);
                flag = 1;
            }
        }
        int m = p.size();
        if(m==1)res = 1;
        else{
            p[m-1] = 1;
            vector<ll > dp(m);
            vector<ll> dp2(m);
            rep(i,m){
                if(i==0){
                    dp[i] = p[i];
                    dp2[i] = p[i];
                }else if(i==1){
                    dp[i] = dp2[i-1]*p[i]%mod;
                    dp2[i] = dp[i];
                }else{
                    if(i%2==0){
                        dp[i] = p[i]*(dp2[i-1]+1)%mod; 
                    }else{
                        dp[i] = p[i]*(dp2[i-1])%mod; 
                    }
                    dp2[i] = dp2[i-2]+dp[i];
                    dp2[i]%=mod;
                }
            }
            // for(auto x:p){
            //     cerr << x << " ";
            // }
            // cerr << endl;
            //cerr << dp[0] << " " << dp[1] << " " << dp[2] << endl;
            //cerr << m << endl;
            res += dp[m-1];
            res %= mod;
        }
    }
    
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 45260