#include <bits/stdc++.h>

#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define INF  (1<<30)
#define INFL (1LL<<60)
#define MOD 1000000007
#define EPS ((ld)(1e-9))

#define sz(x) ((int)(x).size())
#define setz(x) memset(x, 0, sizeof(x))
#define rep(i, x)  for (int i = 0, _##i = (x); i < _##i; i++)
#define repp(i, x) for (int i = 1, _##i = (x); i <= _##i; i++)
#define repr(i, s, e) for (int i = (s), _##i = (e); i < _##i; i++)
#define repi(i, x) for (auto &i : (x))

#ifndef __SOULTCH
#define endl '\n'
#define debug(...) 
#else
#define __debug_a(v) cout << " [+] " << #v << " = " << (v) << endl
#define __debug_b(v) cout << "     " << #v << " = " << (v) << endl
#define debug1(v1) __debug_a(v1);
#define debug2(v1, v2) __debug_a(v1), __debug_b(v2);
#define debug3(v1, v2, v3) __debug_a(v1), __debug_b(v2), __debug_b(v3);
#define GET_MACRO(_1,_2,_3,NAME,...) NAME
#define debug(...) GET_MACRO(__VA_ARGS__, debug3, debug2, debug1)(__VA_ARGS__)
#endif

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ld, ld> pdd;
typedef pair<ll, ll> pll;

template<typename T, typename V>
ostream &operator<<(ostream &os, const pair<T, V> pai) { 
    return os << pai.first << ' ' << pai.second;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> v) {
    rep(i, sz(v)) cout << v[i] << ' ';
    return os;
}

template<typename T>
ostream &operator<<(ostream &os, const set<T> s) {
    for (T p : s) cout << p << ' ';
    return os;
}

template<typename T, typename V>
ostream &operator<<(ostream &os, const map<T, V> s) {
    for (auto p : s) cout << '(' << p << ") ";
    return os;
}

template<typename T, typename V>
istream &operator>>(istream &is, pair<T, V> &pai) {
	is >> pai.first >> pai.second;
	return is;
}

template<typename T> void umax(T &a, T b) {a = max(a, b);}
template<typename T> void umin(T &a, T b) {a = min(a, b);}

int N;
int A[500001];
int cnt[500001];

ll AA[5000001];
ll BB[5000001];
int CC[5000001];

ll ppow(ll a, ll b) {
    ll res = 1;
    for (; b > 0; b >>= 1) {
        if (b&1) res = res*a%MOD;
        a = a*a%MOD;
    }
    return res;
}

int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);

    cin >> N;
    repp(i, N) {
        int t; cin >> t;
        A[i] = A[i-1]^t;
    }


    if (A[N] == 0) {
        int c1 = 0; // 0 count
        repp(i, N) {
            if (A[i] == 0) c1++;
            cnt[i] = cnt[i-1]+(A[i]==0);
        }
        int lll = 0;
        repp(i, 1<<20) CC[i] = -1, AA[i] = 1, BB[i] = 0;
        repp(i, N) if (A[i] != 0) {
            AA[A[i]] = (AA[A[i]]+BB[A[i]]*(cnt[i]-cnt[CC[A[i]]]))%MOD;
            BB[A[i]] = (BB[A[i]]+AA[A[i]])%MOD;
            debug(A[i], cnt[i]-cnt[CC[i]], mp(AA[A[i]], BB[A[i]]));
            CC[A[i]] = i;
        } else {
            lll = i;
            debug(A[i]);
        }

        ll res = ppow(2, c1-1);
        debug(res);
        repp(i, 1<<20) if (CC[i] > 0) res = (res+BB[i])%MOD;
        cout << res << endl;
    } else {
        int c1 = 0; // 0 count

        ll AA = 1, BB = 0;
        repp(i, N) {
            if (A[i] == 0) AA = (BB+AA)%MOD;
            if (A[i] == A[N]) BB = (BB+AA)%MOD;
        }

        cout << AA << endl;
    }
}

Measured memory_bytes: 32256