#include <iostream>
#include <vector>
using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v){
    for (auto &e : t) fill(e, v);
}

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }



template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) v += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr istream& operator >> (istream &is, Fp<MOD>& x) noexcept {
        return is >> x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
const int MOD = 1000000007;
using mint = Fp<MOD>;


int N;
vector<int> A, S;          // S: A の累積 XOR
vector<int> zs;            // zs[i] := S[0:i) の中の 0 の個数
vector<vector<int> > inds; // inds[v] := S の中の v のある index たち

mint subsolve(int d, bool iszero = false) { 
    auto p = inds[d];
    int K = (int)p.size();
    vector<int> q(K+1, 0);
    for (int i = 0; i < K; ++i) q[i] = zs[p[i]] - zs[p[0]];

    vector<mint> dp(K+1, 0), sdp(K+2, 0), sdp2(K+2, 0);
    dp[0] = 1;
    for (int i = 1; i <= K; ++i) {
        dp[i] = sdp[i] * q[i-1] - sdp2[i] + 1;
        sdp[i+1] = sdp[i] + dp[i];
        sdp2[i+1] = sdp2[i] + dp[i] * q[i-1];
    }
    mint res = 0;
    if (!iszero) for (int i = 1; i <= K; ++i) res += dp[i];
    else res = dp.back();   
    return res;
}

mint solve() {
    S.assign(N+1, 0);
    for (int i = 0; i < N; ++i) S[i+1] = S[i] ^ A[i];
    zs.assign(N+2, 0);
    for (int i = 0; i < N+1; ++i) zs[i+1] = zs[i] + (S[i] == 0);
    inds.assign((1<<20)+1, vector<int>());
    for (int i = 0; i < N+1; ++i) inds[S[i]].push_back(i);

    mint res = 0;
    if (S.back() == 0) {
        int zeronum = (int)inds[0].size() - 2;
        res += modpow(mint(2), zeronum); // 全て 0 のケース
        for (int d = 1; d < (1<<20); ++d) {
            if (inds[d].empty()) continue;
            res += subsolve(d);
        }
    }
    else res = subsolve(S.back(), true);
    return res;
}

int main() {
    cin >> N; A.resize(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    cout << solve() << endl;
}


Measured memory_bytes: 42728