/////////////////////////   _LeMur_
#define _CRT_SECURE_NO_WARNINGS
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cassert>
#include <chrono>
#include <random>
#include <bitset>
#include <cstdio>
#include <vector>
#include <string>
#include <ctime>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <list>
#include <map>
#include <set>

using namespace std;

const int N = 500005;
const int inf = 1000 * 1000 * 1000;
const int mod = 1000 * 1000 * 1000 + 7;
const int magic = 300;

int n;
int a[N];

int DP[N][3];
int dp[3];
vector <int> g;

unordered_map <int,int> ind;

int nxt[N] , id[N];
int pref[N];

pair <int,int> mas[N];

int main() {
    mt19937 myrand(chrono::steady_clock::now().time_since_epoch().count());
    cin >> n;
    int z = 0;
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        a[i] ^= a[i - 1];
        pref[i] = pref[i - 1] + (a[i] == 0);
        if(a[i]) g.push_back(a[i]);
    }
    ///
    sort(g.begin() , g.end());
    g.resize( unique(g.begin() , g.end()) - g.begin() );
    for(int i=0;i<(int)g.size();i++){
        ind[ g[i] ] = i + 1;
    }
    for(int i=1;i<=n;i++){
        if(a[i]){
            a[i] = ind[ a[i] ];
        }
    }
    ///
    for(int i=1;i<=(int)g.size();i++){
        id[i] = n + 1;
    }
    for(int i=n;i>=1;i--){
        int x = a[i];
        if(x == 0)continue;
        nxt[i] = id[x];
        id[x] = i;
    }
    ///
    if(a[n] == 0){
        int answ = 1;
        for(int i=1;i<pref[n];i++){
            answ *= 2;
            answ %= mod;
        }
        if((int)g.size() < magic){
            for(int i=1;i<=(int)g.size();i++){
                DP[i][0] = 1;
                DP[i][1] = 0;
            }
            for(int i=1;i<n;i++){
                if(a[i] == 0){
                    for(int j=1;j<=(int)g.size();j++){
                        DP[j][0] += DP[j][1];
                        DP[j][0] %= mod;
                    }
                }
                else{
                    int x = a[i];
                    DP[x][1] += DP[x][0];
                    DP[x][1] %= mod;
                }
            }
            for(int i=1;i<=(int)g.size();i++){
                answ += DP[i][1];
                answ %= mod;
            }
            cout << answ << endl;
        }
        else{
            for(int i=1;i<=(int)g.size();i++){
                int v = id[i];
                int z = 0;
                while(v != n + 1){
                    mas[++z] = (make_pair(i , 1));
                    int s = pref[ nxt[v] - 1 ] - pref[v];
                    if(nxt[v] != n + 1) mas[++z] = (make_pair(0 , s));
                    v = nxt[v];
                }
                dp[0] = 1;
                dp[1] = 0;
                for(int j=1;j<=z;j++){
                    int q = mas[j].second;
                    if(mas[j].first == 0){
                        dp[0] += q * 1ll * dp[1] % mod;
                      	dp[0] %= mod;
                    }
                    else{
                        dp[1] += q * 1ll * dp[0] % mod;
                      	dp[1] %= mod;
                    }
                }
                answ += dp[1];
                answ %= mod;
            }
            cout << answ << endl;
        }
    }
    else{
        dp[0] = 1;
        dp[1] = 0;
        for(int i=1;i<n;i++){
            if(a[i] == 0){
                dp[0] += dp[1];
                dp[0] %= mod;
            }
            if(a[i] == a[n]){
                dp[1] += dp[0];
                dp[1] %= mod;
            }
        }
        cout << dp[0] << endl;
    }
	return 0;
}


Measured memory_bytes: 26012