#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) scanf("%d", &A[i]);
    
    vector<vector<int>> accum(1<<20);
    int now = 0;
    vector<ll> zero(N+1, 0);
    for (int i = 0; i < N; i++) {
        now ^= A[i];
        accum[now].push_back(i+1);
        if (now == 0) zero[i+1]++;
    }
    
    for (int i = 0; i < N; i++) {
        zero[i+1] += zero[i];
    }
    
    ll mod = 1e9+7;
    
    if (now > 0) {
        int K = accum[now].size(); 
        vector<ll> dp0(K+1, 0), dp1(K+1, 0);
        dp0[0] = 1;
        
        for (int i = 1; i <= K; i++) {
            if (i == 1) {
                dp0[i] = 1;
                dp1[i] = 1;
            }
            else {
                ll n = zero[accum[now][i-1]] - zero[accum[now][i-2]];
                dp0[i] = (dp0[i-1] + n * dp1[i-1]) % mod;
                dp1[i] = (dp0[i-1] + (n+1) * dp1[i-1]) % mod;
            }
        }
        cout << dp0[K]%mod << endl;
    }
    else {
        ll ans = 1;
        for (int i = 0; i < (int)accum[0].size()-1; i++) {
            ans = ans * 2 % mod;
        }
        
        for (int i = 1; i < (1<<20); i++) {
            if (accum[i].empty()) continue;
            int K = accum[i].size(); 
            vector<ll> dp0(K+1, 0), dp1(K+1, 0);
            dp0[0] = 1;
        
            for (int j = 1; j <= K; j++) {
                if (j == 1) {
                    dp0[j] = 1;
                    dp1[j] = 1;
                }
                else {
                    ll n = zero[accum[i][j-1]] - zero[accum[i][j-2]];
                    dp0[j] = (dp0[j-1] + n * dp1[j-1]) % mod;
                    dp1[j] = (dp0[j-1] + (n+1) * dp1[j-1]) % mod;
                }
            }
            ans += dp1[K];
        }
        cout << ans%mod << endl;
    }
    
    return 0;
}
#include <bits/stdc++.h>
using namespace std; 
const int maxn = 5000500;
const int mod = 1e9 + 7;
int a[maxn], pref[maxn], cntzer[maxn];
long long dp[maxn];
vector < int > v[maxn];
long long add(long long a, long long b){
    a += b;
    if(a >= mod) a -= mod;
    return a;
}

long long mul(long long a, long long b){
    return (a * b) % mod;
}

long long solve_fixed(int n, int X){
    dp[pref[n - 1]] = 1;
    long long ans = (pref[n - 1] == X ? 1:0);
    for(int i = n - 2 ; i >= 0 ; --i){
        if(pref[i] == X) ans = add(ans, dp[0]);
        dp[pref[i]] = add(dp[pref[i]],dp[X ^ pref[i]]);
    }
    return ans;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    long long xr = 0;
    for(int i = 0 ; i < n ; ++i)
        cin >> a[i];
    pref[0] = a[0];
    cntzer[0] = (a[0] ? 0:1);
    v[a[0]].push_back(0);
    for(int i = 1 ; i < n ; ++i){
        pref[i] = a[i] ^ pref[i - 1];
        cntzer[i] = !pref[i] + cntzer[i - 1];
        v[pref[i]].push_back(i);
    }
    long long ans = solve_fixed(n, 0);
    for(int i = 1 ; i < maxn ; ++i){
        if((int)v[i].size() == 0 || (v[i][(int)v[i].size() - 1] != n - 1 && pref[n - 1])) continue;
        long long smx = 1, sm0 = !pref[n - 1];
        ans = add(ans, smx);
        for(int j = (int)v[i].size() - 2 ; j >= 0 ; --j){
            sm0 = add(sm0, mul(cntzer[v[i][j + 1]] - cntzer[v[i][j]], smx));
            ans = add(ans, sm0);
            smx = add(smx, sm0);
        }
    }
    cout << ans << '\n';
    return 0;

}