#include<iostream>
#include<map>
#include<vector>
using namespace std;
const int mod=1e9+7;

int modpow(long a,int p){
	long res=1;
	while(p){
		if(p&1) (res*=a)%=mod;
		(a*=a)%=mod;
		p>>=1;
	}
	return res;
}

int main(){
	int n;
	cin >> n;
	int a[n];
	for(int i=0;i<n;i++) cin >> a[i];
	int x[n];
	x[0]=a[0];
	for(int i=1;i<n;i++) x[i]=a[i]^x[i-1];
	map<int,vector<int>> m;
	for(int i=0;i<n;i++) if(x[i]) m[x[i]].push_back(i);

	long ans=0;
	if(x[n-1]==0){
		int znum[n];
		znum[0]=(x[0]==0);
		for(int i=1;i<n;i++) znum[i]=znum[i-1]+(x[i]==0);
		long res=0;
		for(auto p:m){
			vector<int> v=p.second;
			long z=1,o=0;
			int cur=0;
			for(int i:v){
				long zero=znum[i]-znum[cur];
				long zn=(o*zero+z)%mod;
				long on=(zn+o)%mod;
				z=zn;
				o=on;
				cur=i;
			}
			(res+=o)%=mod;
		}
		(res+=modpow(2,znum[n-1]-1))%=mod;
		ans=res;
	}else{
		int y=x[n-1];
		long z=1,o=0;
		for(int i=0;i<n;i++){
			if(x[i]==0) (z+=o)%=mod;
			else if(x[i]==y) (o+=z)%=mod;
		}
		ans=z;
	}
	cout << ans << endl;
	return 0;
}

#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

main() {
    int64_t n;
    cin >> n;

    int64_t x = 0;
    vector<int64_t> xx(n);
    for (auto i : irange(0L, n)) {
        int64_t aa;
        cin >> aa;

        x ^= aa;
        xx[i] = x;
    }

    constexpr auto M = 1000000007;

    auto last_x = xx.back();
    cerr << last_x << endl;
    if (last_x > 0) {
        int64_t count = 0;
        int64_t count0 = 0;
        for (auto x : xx) {
            if (x == 0) {
                count0 += count;
                count0 %= M;
            } else if (x == last_x) {
                count += count0 + 1;
                count %= M;
            }
        }
        cout << count0 + 1 << endl;
    } else {
        unordered_map<int64_t, int64_t> count0;
        unordered_map<int64_t, int64_t> count;
        unordered_map<int64_t, int64_t> last_num0;
        int64_t num0 = 0;
        for (auto i : irange(0L, n)) {
            auto x = xx[i];
            if (x == 0) {
                ++num0;
            } else {
                count0[x] += (count[x] * ((num0 - last_num0[x]) % M)) % M;
                count[x] += count0[x] + 1;
                count[x] %= M;
                last_num0[x] = num0;
            }
        }

        int64_t ans = 0;
        for (auto kv : count) {
            ans += kv.second;
            ans %= M;
        }

        int64_t p0 = 1;
        for (auto i : irange(0L, num0 - 1)) {
            p0 *= 2;
            p0 %= M;
        }

        cerr << ans << endl;
        cerr << p0 << endl;
        cout << (ans + p0) % M << endl;
    }
}