#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
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; }

#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } 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 MAX = 1001010;
const int MOD = 1000000007;
using mint = Fp<MOD>;



int N;
vector<int> A, S;
vector<int> zS;
map<int, vector<int> > ma;

mint subsolve(int d, bool iszero = false) {
    //cout << "------------------" << endl; COUT(d);
    
    auto p = ma[d];
    int K = (int)p.size();
    vector<int> q(K, 0), sq(K+1, 0);
    for (int i = 1; i < K; ++i) {
        q[i] = zS[p[i]] - zS[p[i-1]];
    }
    for (int i = 0; i < K; ++i) {
        sq[i+1] = sq[i] + q[i];
    }

    //COUT(p); COUT(q); COUT(sq);
    
    vector<mint> dp(K+1, 0), sdp(K+2, 0), sdp2(K+2, 0);
    dp[0] = 1; sdp[1] = 1; sdp2[1] = sq[0];
    for (int i = 1; i <= K; ++i) {
        dp[i] = ((sdp[i] - sdp[1]) * sq[i]) - (sdp2[i] - sdp2[1]) + 1;
        sdp[i+1] = sdp[i] + dp[i];
        sdp2[i+1] = sdp2[i] + dp[i] * sq[i];

        // cout << i << ": " << dp[i] << endl;
    }

    mint res = 0;
    if (!iszero) {
        for (int i = 1; i <= K; ++i) res += dp[i];
    }
    else {
        res = dp.back();
    }
    
    //COUT(res);
    
    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);
    }
    ma.clear();
    for (int i = 0; i < N+1; ++i) {
        ma[S[i]].push_back(i);
    }

    
    //COUT(S); COUT(zS); COUT(ma);
    
    
    mint res = 0;
    if (S.back() == 0) {
        int zeronum = ma[0].size();
        zeronum -= 2;
        mint first = modpow(mint(2), zeronum);
        res += first;
        for (auto it : ma) {
            if (it.first == 0) continue;
            mint add = subsolve(it.first);
            res += add;
        }
    }
    else {
        int d = S.back();
        res += subsolve(d, true);
    }
    return res;
}

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




















Measured memory_bytes: 38772