#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template <size_t I, class H, class... T> struct TupleReaderWriter{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple_cat(tuple<H>(v),TupleReaderWriter<sizeof...(T)-1,T...>::r(i));}static void w(ostream&o,tuple<H,T...>&t,string d){TupleReaderWriter<I-1,H,T...>::w(o,t,d);o<<d<<get<I>(t);}};
template <class H, class... T> struct TupleReaderWriter<0,H,T...>{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple<H>(v);}static void w(ostream&o,tuple<H,T...>&t,string d){o<<get<0>(t);}};
template <class... T> istream& operator>>(istream&i,tuple<T...>& t) { t = TupleReaderWriter<sizeof...(T), T...>::r(i); return i; }
template <class... T> ostream& operator<<(ostream& o, tuple<T...>& t) { string delim = " "; TupleReaderWriter<sizeof...(T) - 1, T...>::w(o, t, delim); return o; }
template<typename T> using rev_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using vector2d = vector<vector<T>>;
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }

const i64 MOD = 1e9 + 7;

// O(log a)
int64_t powmod(int64_t a, int64_t p) {
    int64_t value = 1;
    for (int64_t mul = a; p > 0; p >>= 1, mul = (mul * mul) % MOD) {
        if (p & 1) value = (value * mul) % MOD;
    }
    return value;
}

int64_t invmod(int64_t x) {
    return powmod(x, MOD - 2);
}

struct int_m {
    static int64_t mod;
    int64_t v;
    int_m() {}
    int_m(int64_t x) : v(x) {}
    int_m operator+(const int_m &y) { return (v + y.v) % mod; }
    int_m operator-(const int_m &y) { return (v - y.v + mod) % mod; }
    int_m operator*(const int_m &y) { return (v * y.v) % mod; }
    int_m operator/(const int_m &y) { return (v * invmod(y.v)) % mod; }
    void operator+=(const int_m &y) { *this = *this + y; }
    void operator-=(const int_m &y) { *this = *this - y; }
    void operator*=(const int_m &y) { *this = *this * y; }
    void operator/=(const int_m &y) { *this = *this / y; }
    friend istream &operator>>(istream &ist, int_m &m) { return ist >> m.v; }
    friend ostream &operator<<(ostream &ost, int_m &m) { return ost << m.v; }
};

int64_t int_m::mod = MOD;

int main() {
    int N;
    cin >> N;
    vector<i64> A(N), X(N), zeros(N, 0);
    for(auto &x : A) cin >> x;
    for(int i = 0; i < N; i++) {
        X[i] = A[i];
        if(i) X[i] ^= X[i - 1];
        if(X[i] == 0) zeros[i]++;
        if(i) zeros[i] += zeros[i - 1];
    }

    // 値v -> (最終位置, 最後に取ったのが0の場合の数, 最後に取ったのがvの場合の数)
    map<i64, tuple<int, int_m, int_m>> m;

    for (int i = 0; i < N; i++) {
        if (X[i] == 0) continue;
        if (!m.count(X[i])) {
            m[X[i]] = make_tuple(i, 1, 1);
        } else {
            int j;
            int_m n0, nv;
            tie(j, n0, nv) = m[X[i]];
            m[X[i]] = make_tuple(i,
                n0 + nv * (zeros[i] - zeros[j]),        // そのまま + 0取る
                n0 + nv * (zeros[i] - zeros[j]) + nv);  // そのまま + V取る + 0取りV取る
        }
    }

    int_m ans = 0;
    if(X[N - 1] == 0) {
        int num = -1;
        for(int i = 0; i < N; i++) {
            if(X[i] == 0) num++;
        }
        ans += powmod(2, num);

        for(auto x : m) {
            int j;
            int_m n0, nv;
            tie(j, n0, nv) = x.second;
            ans += nv;
        }

    } else {
        int j;
        int_m n0, nv;
        tie(j, n0, nv) = m[X[N - 1]];
        ans += n0 + nv * (zeros[N - 1] - zeros[j]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 34432