#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const ll mod = 1e9 + 7;

ll add(ll x, ll y){
    return (x+y)%mod;
}

ll mul(ll x, ll y){
    return (x%mod)*(y%mod)%mod;
}

ll powll(ll x, ll y){
    x %= mod;
    ll res = 1LL;
    while(y){
        if (y & 1LL)
            res *= x;
        res %= mod;
        x = (x*x) % mod;
        y >>= 1LL;
    }
    return res;
}

ll naive(VI a, int x){
    // cout << "naive" << endl;
    int n = a.size();
    VVL dp(n + 1, VL(2));
    dp[0][0] = 1;
    int y = 0;
    REP(i,n){
        y ^= a[i];
        if (y == x){
            REP(j,i+1) dp[i+1][1] += dp[j][0];
        }
        if (y == 0){
            REP(j,i+1) dp[i+1][0] += dp[j][1];
        }
        // cout << dp[0] << " " << dp[1] << endl;
    }
    // REP(i,n+1) cout << dp[i][0] << " " << dp[i][1] <<endl;

    return dp[n][0];
}

ll calc(VL a, VL b){
    int n = a.size();
    if (n == 1) return a[0];
    VL dp(n);
    dp[0] = a[0];
    ll sum = dp[0], tmp = 0;
    REP(i,n-1){
        tmp = (tmp + b[i] * sum) % mod;
        dp[i + 1] = ((tmp + 1) * a[i + 1]) % mod;
        sum = (sum + dp[i + 1]) % mod;
    }
    ll ret = 0;
    REP(i,n) ret = (ret + dp[i]) % mod;
    return ret;
}

int main() {
    int n;
    cin >> n;
    VI a(n);
    int x = 0;
    REP(i,n){
        a[i] = in();
        x ^= a[i];
    }

    if (x != 0){
        VL dp(2);
        dp[0] = 1;
        int y = 0;
        REP(i,n){
            y ^= a[i];
            if (y == x){
                dp[1] = (dp[1] + dp[0]) % mod;
            }
            if (y == 0){
                dp[0] = (dp[0] + dp[1]) % mod;
            }
        }
        cout << dp[0] << endl;
        return 0;
    }

    ll cnt = 0;
    int j = 0;
    map<int, VL> mpc, mpl;
    map<int, int> last;
    REP(i,n){
        x ^= a[i];
        if (x == 0){
            map<int, ll> tmp;
            int p = 0;
            FOR(k,j,i-1){
                p ^= a[k];
                tmp[p]++;
            }
            // FOR(k,j,i){
            //     cout << a[k] << " ";
            // }
            // cout << endl;
            for (auto hoge : tmp){
                int p = hoge.first;
                ll c = hoge.second;
                mpc[p].push_back(c);
                if (last.count(p)){
                    mpl[p].push_back(cnt - last[p]);
                }
                last[p] = cnt;
            }
            cnt++;
            j = i + 1;
        }
    }

    // cout << cnt << " " << powll(2, cnt - 1) << endl;

    ll ans = powll(2, cnt - 1);
    for (auto tmp : mpc){
        int x = tmp.first;
        // cout << "x" << x << endl;
        // for (int c : mpc[x]) cout << c << " ";
        // cout << endl;
        // for (int l : mpl[x]) cout << l << " ";
        // cout << endl;
        // cout << naive(a, x) << endl;

        ans = (ans + calc(mpc[x], mpl[x])) % mod;
    }
    cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

signed main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    Int(n);
    vector<int> data(n);
    for (int i = 0; i < n; i++) {
        cin >> data[i];
    }
    Rep(i, n) data[i] ^= data[i-1];

    vi dp0(1 << 20, 1), dp1(1 << 20, 0), zeros(1 << 20, 0);
    // 始点に 0 があると考えるので全ての x について初期0数1個
    int zero = 0; 
    rep(i, n) {
        if (!data[i]) {
            zero++;
        } else {
            (dp0[data[i]] += dp1[data[i]] * (zero - zeros[data[i]])) %= MOD; // 0 の累積を求める
            (dp1[data[i]] += dp0[data[i]]) %= MOD; // i 番目の解が求められ、区間の値 k = data[i] の時の解の累積が増える
            zeros[data[i]] = zero;
            //std::cout << dp0[data[i]] << " , " << dp1[data[i]] << std::endl;
        }
    }

    if (data.back()) {
        std::cout << dp0[data.back()] << std::endl;
    } else {
        int ans = 1;
        rep(i, zero-1) ans = (ans * 2) % MOD;
        rep(i, dp1.size()) ans += dp1[i];
        std::cout << ans % MOD << std::endl;
    }

    return 0;
}
