#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=5e5+5,mod=1e9+7;
int n,a[N],sum[N];
vector<int>v[1300000];
int f(int l,int r){return sum[r]-sum[l-1];}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]),a[i]^=a[i-1];
    for(int i=1;i<=n;i++)
    {
        sum[i]=sum[i-1]+(a[i]==0);
        v[a[i]].push_back(i);
    }
    ll ans=0;
    for(int i=0;i<1<<20;i++)
    {
        if(!v[i].size()) continue;
        if(a[n]!=0&&a[n]!=i) continue;
        ll res=1,dp0=1,sumres=1;
        for(int j=1;j<v[i].size();j++)
        {
            if(i==0) dp0=res+1,res=(res+dp0)%mod;
            else
            {
                dp0=(dp0+sumres*f(v[i][j-1],v[i][j]))%mod;
                res=dp0;
                sumres=(sumres+res)%mod;
            }
        }
        if(a[n]==0&&i==0) ans=(ans+dp0)%mod;
        else if(a[n]==0) ans=(ans+sumres)%mod;
        else ans=(ans+res)%mod;
    }
    printf("%lld\n",ans);
}
