#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<utility>
#include<map>
#include<ctime>
#include<cstdio>
#include<cassert>
#include<functional>
#include<unordered_map>




using namespace std;

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

#define show(x) cerr << x
#define debug(x) show(#x << ": " << (x) << endl)

const long double PI = 3.14159265358979323846;
const long double eps = 1e-5;
const int INF = numeric_limits<int>::max();
const ll LINF = numeric_limits<ll>::max();
const ll mod = 1000 * 1000 * 1000 + 7;

ll power(ll x, ll n) {
    ll res = 1;
    while (n) {
        if (n & 1)
            res = (res * x) % mod;
        x = (x * x) % mod;
        n /= 2;
    }
    return res;
}


pll solve(int n, const vector<int>& pr, vector<int>& pos, const vector<int>& pr0) {
    ll res0 = 1, res1 = 0;
    //cerr << "start\n";
    vector<int> d;
    for (int i = 1; i < pos.size(); ++i) {
        ll x = pr0[pos[i]] - pr0[pos[i - 1]];
        d.push_back(x);
    }
    d.push_back(0);
    for (int i = 0; i < d.size(); ++i) {
        ll z = res0;
        ll x = d[i];
        res0 = (res0 * (x + 1) + res1 * x) % mod;
        res1 = (res1 + z) % mod;
        //cerr << x << " ";
    }
    //cerr << endl;
    return pll(res0, res1);

}


pll solve2(int n, const vector<int>& pr, vector<int>& pos, const vector<int>& pr0) {
    ll res0 = 1, res1 = 0;
    //cerr << "start\n";
    vector<int> d;
    for (int i = 1; i < pos.size(); ++i) {
        ll x = pr0[pos[i]] - pr0[pos[i - 1]];
        d.push_back(x);
    }
    for (int i = 0; i < d.size(); ++i) {
        ll z = res0;
        ll x = d[i];
        res0 = (res0 * (x + 1) + res1 * x) % mod;
        res1 = (res1 + z) % mod;
        //cerr << x << " ";
    }
    //cerr << endl;
    return pll(res0, res1);

}

void solve() {
    int n;
    cin >> n;
    int N = 1 << 20;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    vector<int> pr(n + 1, 0);
    pr[0] = 0;
    for (int i = 0; i < n; ++i) {
        pr[i + 1] = pr[i] ^ a[i];
    }
    /*for (int i = 0; i <= n; ++i)
        cerr << pr[i] << " ";
    cerr << endl;*/
    vector<vector<int> > pos(N);
    for (int i = 1; i <= n; ++i)
        pos[pr[i]].push_back(i);
    vector<int> pr0(n + 1, 0);
    for (int i = 1; i <= n; ++i)
        pr0[i] = pr0[i - 1] + (pr[i] == 0);
    ll res = 0;
    if (pr[n] != 0) {
        //pll cur = solve2(n, pr, pos[pr[n]], pr0);
        //cerr << cur.first << " " << cur.second << endl;
        res = solve2(n, pr, pos[pr[n]], pr0).first;
    }
    else {
        for (int i = 1; i < N; ++i) {
            if (!pos[i].empty()) {
                ll cur = solve(n, pr, pos[i], pr0).second;
                res += cur;
                //cerr << i << " " << cur << endl;
            }
        }
        res = (res + power(2, pr0[n] - 1)) % mod;
    }
    cout << res << endl;

    
    
}

//#define LOCAL

int main() {
    ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    solve();


#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif	
    return 0;
}


Measured memory_bytes: 40308