#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

ll fastPow(ll x, ll n)
{
    ll res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * x % MOD;
        x = x * x % MOD;
        n >>= 1;
    }
    return res;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, a[512345];
    V v;
    v.push_back(0);

    cin >> n;
    REP(i, n)
    {
        cin >> a[i];
        v.push_back(v[v.size() - 1] ^ a[i]);
    }

    if (v[v.size() - 1] != 0)
    {
        int last = v[v.size() - 1];

        ll dp[2][2];
        auto cur = dp[0];
        auto nex = dp[1];
        cur[0] = 1;
        cur[1] = 0;

        for (int i = 1; i < v.size(); i++)
        {
            nex[0] = cur[0];
            nex[1] = i == v.size() - 1 ? 0 : cur[1];
            if (v[i] == last)
                (nex[1] += cur[0]) %= MOD;
            if (v[i] == 0)
                (nex[0] += cur[1]) %= MOD;

            swap(cur, nex);
        }

        cout << cur[1] << endl;

        return 0;
    }

    V w[1 << 22];

    int reiwa[512345];
    reiwa[0] = 0;

    int ma = 0;

    REP(i, v.size())
    {
        reiwa[i + 1] = reiwa[i];
        if (v[i] != 0)
        {
            w[v[i]].push_back(i);
            ma = max(ma, v[i]);
        }
        else
        {
            reiwa[i + 1]++;
        }
    }

    ll res = 0;

    for (int i = 1; i <= ma; i++)
    {
        if (!w[i].size())
            continue;

        V p;

        p.push_back(1);

        int j = 0;
        while (j < w[i].size())
        {
            int cnt = 1;
            j++;
            while (j < w[i].size() && reiwa[w[i][j]] - reiwa[w[i][j - 1]] == 0)
            {
                cnt++;
                j++;
            }
            p.push_back(cnt);

            if (j == w[i].size())
            {
                p.push_back(1);
                j++;
            }
            else
                p.push_back(reiwa[w[i][j]] - reiwa[w[i][j - 1]]);
        }

        ll dp[2][2];

        auto cur = dp[0];
        auto nex = dp[1];

        cur[0] = 1;
        cur[1] = 0;

        for (int j = 1; j < p.size(); j++)
        {
            nex[0] = j == p.size() - 1 ? 0 : cur[0];
            nex[1] = cur[1];

            if (j % 2)
                (nex[1] += cur[0] * p[j]) %= MOD;
            else
                (nex[0] += cur[1] * p[j]) %= MOD;

            swap(cur, nex);
        }

        (res += cur[0]) %= MOD;
    }

    (res += fastPow(2, reiwa[v.size()] - 2)) %= MOD;

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 113520