// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = int64_t;
using ull = uint64_t;
using PLL = pair<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
// #include "../debug/debug.cpp"
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

const ll mod = 1e9 + 7;
    
const size_t cnt_size = (1ll << 21) + 10;

ll solve() {
    ll N;
    cin >> N;
    V<ll> A(N);
    for(auto &&ele : A) cin >> ele;

    ll xor_sum = 0;
    V<ll> cnt_zero(cnt_size), cnt_pos(cnt_size), zero_sum(cnt_size);
    ll idx_a = 0, back_a = N, prefix_zero = 0, suffix_zero = 0;
    
    while(idx_a < N && A[idx_a] == 0) idx_a++;
    prefix_zero = idx_a;
    
    if(idx_a == N) {
        ll ret = 1;
        for(ll i = 1; i < N; i++) (ret *= 2) %= mod;
        return ret;
    }
    
    while(A[back_a - 1] == 0) back_a--;
    suffix_zero = N - back_a;

    DEBUG(make_tuple(prefix_zero, suffix_zero, idx_a, back_a));
    ll zero = 0;
    
    for(; idx_a < back_a; idx_a++) {
        ll num = A[idx_a];
        xor_sum ^= num;

        if(xor_sum == 0) {
            zero++;
            continue;
        }

        DEBUG(xor_sum);

        ll diff_zero = zero - zero_sum[xor_sum];
        zero_sum[xor_sum] = zero;
        (cnt_zero[xor_sum] += cnt_pos[xor_sum] * diff_zero % mod) %= mod;
        (cnt_pos[xor_sum] += cnt_zero[xor_sum] + 1) %= mod;

        DEBUG(cnt_pos[xor_sum]);
    }

    if(xor_sum) return (cnt_zero[xor_sum] + 1) % mod;

    ll ans = 1;
    for(ll i = 1; i < zero + suffix_zero + prefix_zero; i++) (ans *= 2) %= mod;
    DEBUG(ans);
    for(ll i = 0; i < 10; i++) DEBUG(PLL(i, cnt_zero[i]));
    (ans += accumulate(next(cnt_pos.begin()), cnt_pos.end(), 0ll)) %= mod;

    return ans;
}

int main() {
    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 53504