#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 5e5;
const int MAXV = (1<<20);
const ll MOD = 1e9+7;

int N, A[MAXN+10], zero[MAXN+10];
vector<int> pos[MAXV+10];

ll solve(int x, int t)
{
    int i, j;
    ll dp[2]={1, 0};
    for(i=1; i<pos[x].size(); i++)
    {
        ll now=pos[x][i], gap=zero[pos[x][i]]-zero[pos[x][i-1]];
        dp[0]+=gap*dp[1]%MOD;
        dp[1]+=dp[0];
        dp[0]%=MOD; dp[1]%=MOD;
        //printf("%lld %lld %lld\n", dp[0], dp[1], gap);
    }
    return dp[t];
}

int main()
{
    int i, j;

    scanf("%d", &N);
    for(i=1; i<=N; i++) scanf("%d", &A[i]), A[i]^=A[i-1];
    for(i=1; i<=N; i++) zero[i]=zero[i-1]+(A[i]==0);

    for(i=0; i<MAXV; i++) pos[i].push_back(0);
    for(i=1; i<=N; i++) pos[A[i]].push_back(i);

    if(A[N]!=0)
    {
        printf("%lld", solve(A[N], 0));
    }
    else
    {
        ll ans=0;
        for(i=1; i<MAXV; i++) ans=(ans+solve(i, 1))%MOD;
        ll t=1;
        for(i=1; i<zero[N]; i++) t=t*2%MOD;
        ans+=t;
        ans%=MOD;
        printf("%lld", ans);
    }
}
