#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

ll modadd(ll x, ll y) {
    return ((x + y) % mod + mod) % mod;
}

ll modminus(ll x, ll y) {
    return (x - y + mod) % mod;
}

ll multiply(ll x, ll y) {
    return (x % mod) * (y % mod) % mod;
}

ll modpower(ll x, ll y) {
    if (y == 0) {
        return 1;
    } else if (y == 1) {
        return x % mod;
    } else if (y % 2 == 0) {
        ll p = modpower(x, y / 2);
        return p * p % mod;
    } else {
        ll p = modpower (x, y / 2);
        return (p * p) % mod * (x % mod) % mod;
    }
}

ll dp[3][1 << 20];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll a[N];
    REP(i, 0, N) {
        cin >> a[i];
    }
    ll acc[N + 1];
    acc[0] = 0;
    REP(i, 0, N) {
        acc[i + 1] = acc[i] ^ a[i];
    }
    // REP(i, 0, N + 1) {
    //     cout << acc[i] << " ";
    // }
    // cout << endl;
    // cout << "aaa" << endl;
    //cout << acc[N] << endl;
    if (acc[N] != 0) {
        ll anszero = 0;
        ll anspt = 0;
        ll num = acc[N];
        bool st = false;
        REP(i, 1, N + 1) {
            if (acc[i] == 0) {
                if (st) {
                    anszero = modadd(anszero, anspt);
                }
            } else if (acc[i] == num) {
                anspt = modadd(anspt, (anszero + 1));
                st = true;
            }
        }
        cout << modadd(anszero, 1) << endl;
    } else {
        vector<ll> vec;
        ll ans = 0;
        ll zero = 0;
        REP(i, 0, N) {
            if (acc[i + 1] == 0) {
                zero++;
                sort(vec.begin(), vec.end());
                ll tmp = -1;
                ll now = 0;
                vec.push_back(inf);
                REP(j, 0, vec.size()) {
                    if (tmp != vec[j]) {
                        if (now > 0) {
                            if (dp[2][tmp] > 0) {
                                ll num = -1;
                                num = multiply(dp[1][tmp], zero - dp[2][tmp] - 1);
                                dp[0][tmp] = modadd(dp[0][tmp], num);
                                // num = modadd(num, dp[0][tmp] + now);
                                dp[1][tmp] = modadd(dp[1][tmp], multiply(dp[0][tmp] + 1, now));
                                dp[0][tmp] = modadd(dp[0][tmp], dp[1][tmp]);
                                // cout << num << " " << tmp << endl;
                            } else {
                                // num = multiply(dp[0][tmp] + 1, now);
                                dp[0][tmp] = now;
                                dp[1][tmp] = now;
                            }
                            // dp[0][tmp] = modadd(dp[0][tmp], num);
                            // dp[0][tmp] = num;
                            dp[2][tmp] = zero;
                            // cout << num << " " << tmp << endl;
                        }
                        now = 1;
                        tmp = vec[j];
                    } else {
                        now++;
                    }
                }
                vec.clear();
            } else {
                vec.push_back(acc[i + 1]);
            }
        }
        // cout << "bbb" << endl;
        REP(i, 1, (1 << 20)) {
            ans = modadd(ans, dp[1][i]);
            // if (dp[0][i] > 0) {
            //     cout << i << " " << dp[0][i] << endl;;
            // }
        }
        ans = modadd(ans, modpower(2, zero - 1));
        cout << ans << endl;
    }
}


Measured memory_bytes: 32640