#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

constexpr long long MOD = 1000000007LL;

vector<vector<pair<long long,long long>>> make_vector(vector<long long> C) {
    vector<vector<pair<long long,long long>>> V(1<<20);
    vector<long long> cnt(1<<20,0);
    long long zero = 0;
    for (int i=0;i<C.size();i++) {
        if (C[i] == 0) zero++;
        else {
            long long K = C[i];
            long long t = zero - cnt[K];
            if (t>0) {
                V[K].push_back(make_pair(0,t));
            }
            V[K].push_back(make_pair(K,1));
            cnt[K] = zero;
        }
    }
    for (int K=1;K<(1<<20);K++) {
        long long t = zero - cnt[K];
        if (t>0) V[K].push_back(make_pair(0,t));
    }
    V[0].push_back(make_pair(0,zero));
    return V;
}

pair<long long,long long> dp(vector<pair<long long,long long>> V) {
    vector<pair<long long,long long>> D(V.size()+1, make_pair(0,0));
    D[0].first = 1; D[0].second = 0;
    for (int i=1;i<=V.size();i++) {
        if (V[i-1].first == 0) {
            D[i].first = (D[i-1].first + (D[i-1].second)*(V[i-1].second)) % MOD;
            D[i].second = D[i-1].second;
        } else {
            D[i].first = D[i-1].first;
            D[i].second = (D[i-1].first + D[i-1].second) % MOD;
        }
    }
    return D[V.size()];
}

int main(void) {
    int N;
    long long ret = 0;
    cin >> N;
    vector<long long> A(N,-1), C(N+1,-1);
    for (int i=0;i<N;i++) cin >> A[i];

    C[0] = 0;
    for (int i=1;i<=N;i++) C[i] = C[i-1]^A[i-1];
#ifdef DEBUG
    for (int i=0;i<=N;i++) cout << C[i] << " ";
    cout << endl;
    // for (int i=0;i<=N;i++) cout << Z[i] << " ";
    // cout << endl;
#endif

    vector<vector<pair<long long,long long>>> V = make_vector(C);
    if (C[N] != 0) {
        long long X = C[N];
// #ifdef DEBUG
//         for (int i=0;i<V[X].size();i++) cout << V[X][i][0] << " ";
//         cout << endl;
//         for (int i=0;i<V[X].size();i++) cout << V[X][i][1] << " ";
//         cout << endl;
//         for (int i=0;i<=V[X].size();i++) cout << dp[i][0] << " ";
//         cout << endl;
//         for (int i=0;i<=V[X].size();i++) cout << dp[i][1] << " ";
//         cout << endl;
// #endif
        ret = dp(V[X]).first;
    } else {
        vector<long long> U(C);
        sort(U.begin(),U.end());
        reverse(U.begin(), U.end());
        unique(U.begin(), U.end());
        auto itr = find(U.begin(), U.end(), 0);
        U.erase(itr, U.end());

        for (auto& X : U) {
// #ifdef DEBUG
//             cout << X << endl;
//             for (int i=0;i<V[X].size();i++) cout << V[X][i][0] << " ";
//             cout << endl;
//             for (int i=0;i<V[X].size();i++) cout << V[X][i][1] << " ";
//             cout << endl;
//             for (int i=0;i<=V[X].size();i++) cout << dp[i][0] << " ";
//             cout << endl;
//             for (int i=0;i<=V[X].size();i++) cout << dp[i][1] << " ";
//             cout << endl;
// #endif
            ret += dp(V[X]).second;
            ret %= MOD;
#ifdef DEBUG
        cout << X << ": " << ret << endl;
#endif
        }
        long long cnt = V[0][0].second;
#ifdef DEBUG
        cout << "0: " << cnt << endl;
#endif
        long long b = 1;
        for (int j=0;j<cnt-2;j++) {
            b *= 2;
            b %= MOD;
        }
        ret += b;
        ret %= MOD;
#ifdef DEBUG
        cout << ret << endl;
#endif
    }

    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 97536