#define P(x) cout << #x " = " << x << endl
#define PP(x, y) cout << "(" #x ", " #y ") = (" << x << ", " << y << ")" << endl
#define PPP(x, y, z) cout << "(" #x ", " #y ", " #z ") = (" << x << ", " << y << ", " << z << ")" << endl

#include<iostream>
#include<vector>
#include<cassert>
#include<cmath>
#include<map>

using namespace std;
using ll = long long;


const long long MOD = 1000000007;

long long mod(long long a, long long m = MOD)
{
    long long q = a % m;
    if (q < 0)
        q += m;
    return q;
}

long long modadd(long long a, long long b, long long m = MOD)
{
    return (a + b) % m;
}

long long modsub(long long a, long long b, long long m = MOD)
{
    return mod((a % m) - (b % m));
}

long long modmul(long long a, long long b, long long m = MOD)
{
    return (a * b) % m;
}

long long modpow(long long a, long long b, long long m = MOD)
{
    long long c = 1;
    while (b > 0)
    {
        if (b & 1)
            c = modmul(c, a, m);
        a = modmul(a, a, m);
        b >>= 1;
    }
    return c;
}


int n;
int a[500000];
int cumxor[500001];
int cumzero[500001];
int cxnext[500001];
int dp[500001][2];
int main()
{
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    cumxor[0] = 0;
    cumzero[0] = 1;
    for (int i = 0; i < n; ++i) {
        cumxor[i + 1] = a[i] ^ cumxor[i];
        cumzero[i + 1] = cumzero[i] + (cumxor[i + 1] == 0 ? 1 : 0);
    }
    // P(cumxor[n]);
    // for (int i = 0; i <= n; ++i) {
    //     cout << cumxor[i] << " ";
    // }
    // cout << endl;
    if (cumxor[n] != 0) {
        int x = cumxor[n];
        dp[0][0] = 1;
        dp[0][1] = 0;
        for (int i = 1; i <= n; ++i) {
            dp[i][0] = dp[i - 1][0];
            dp[i][1] = dp[i - 1][1];
            if (cumxor[i] == 0) {
                dp[i][0] = modadd(dp[i - 1][1], dp[i - 1][0]);
            } else if (cumxor[i] == x) {
                dp[i][1] = modadd(dp[i - 1][0], dp[i - 1][1]);
            }
        }
        cout << dp[n][0] << endl; 
        return 0;
    }

    map<int, int> last;
    map<int, int> first;
    fill(cxnext, cxnext + n + 1, -1);
    for (int i = 0; i <= n; ++i) {
        int x = cumxor[i];
        auto lastx = last.find(x);
        if (lastx != last.end()) {
            cxnext[(*lastx).second] = i;
        }
        if (first.find(x) == first.end()) {
            first[x] = i;
        }
        last[x] = i;
    }
    // P(cumxor[n]);
    // for (int i = 0; i <= n; ++i) {
    //     cout << i << " " << cumxor[i] << " " << cxnext[i] << " " << cumzero[i] << endl;
    // }
    // cout << endl;

    ll ans = 0;
    for (auto fi : first) {
        int x = fi.first;
        int i = fi.second;
        // PP(x, i);
        if (x == 0) {
            ans = modadd(ans, modpow(2, cumzero[n] - 2));
            continue;
        }
        int lasti = 0;
        dp[i][0] = 1;
        dp[i][1] = 1;

        while (true) {
            lasti = i;
            i = cxnext[i];
            if (i == -1) {
                ans = modadd(ans, dp[lasti][1]);
                break;
            }
            int zeros = cumzero[i] - cumzero[lasti - 1];
            // PP(i, lasti);
            // PPP(x, i, zeros);
            dp[i][0] = modadd(dp[lasti][0], modmul(dp[lasti][1], zeros));
            dp[i][1] = modadd(dp[lasti][1], dp[i][0]);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 38912