output_description: Print the answer.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      A_1 A_2 \ldots A_{N}
attempt: #include <bits/stdc++.h>
  typedef long long ll;
  #define FOR(i,a,b) for(ll i=(a);i<(b);i++)
  #define REP(i,a) FOR(i,0,a)
  using namespace std;
  const ll MAX_N=5e5,MOD=1e9+7;
  typedef pair<ll,ll> P;
  ll N,A[MAX_N+1],psm[MAX_N+2],dp[MAX_N+1][2];
  map<ll,vector<P> > mp;
  map<ll,ll> lst;
  ll mpw(ll n,ll m){
      ll ret=1;
      while(m){
          if(m&1){
              ret*=n;
              ret%=MOD;
          }
          n*=n;
          n%=MOD;
          m>>=1;
      }
      return ret;
  }
  int main(){
  	ios::sync_with_stdio(false);
  	cin.tie(0);
      ll ans=0;
  	cin>>N;
      REP(i,N){
          cin>>A[i+1];
          A[i+1]^=A[i];
      }
      REP(i,N+1){
          psm[i+1]=psm[i];
          if(A[i]==0){
              psm[i+1]++;
          }
      }
      if(A[N]==0){
          REP(i,N){
              if(A[i]!=0){
                  if(psm[i]-psm[lst[A[i]]]>0){
                      mp[A[i]].push_back(P(0,psm[i]-psm[lst[A[i]]]));
                      lst[A[i]]=i;
                  }
                  mp[A[i]].push_back(P(A[i],1));
              }
          }
          for(auto p:lst){
  //            cout<<p.first<<' '<<p.second<<endl;
          }
          for(auto &i:mp){
              if(psm[N+1]-psm[lst[i.first]]>0){
                  i.second.push_back(P(0,psm[N+1]-psm[lst[i.first]]));
              }
          }
          for(const auto &i:mp){
  //            cout<<i.first<<' '<<i.second.size()<<endl;
              dp[0][0]=1;
              dp[0][1]=0;
              REP(j,i.second.size()){
                  //cout<<"    "<<i.second[j].first<<','<<i.second[j].second<<endl;
              }
              FOR(j,1,i.second.size()){
                  REP(k,2)dp[j][k]=dp[j-1][k];
                  if(i.second[j].first==0){
                      dp[j][0]+=dp[j-1][1]*i.second[j].second;
                      dp[j][0]%=MOD;
                  }else{
                      dp[j][1]+=dp[j-1][0]*i.second[j].second;
                      dp[j][1]%=MOD;
                  }
              }
              ans+=dp[i.second.size()-2][1];
              ans%=MOD;
          }
  //        cout<<psm[N+1]<<endl;
          ans+=mpw(2,psm[N+1]-2);
          ans%=MOD;
      }else{
          ll x=A[N];
          dp[0][0]=1;
          FOR(i,1,N+1){
              REP(j,2)dp[i][j]=dp[i-1][j];
              if(A[i]==0){
                  dp[i][0]+=dp[i-1][1];
                  dp[i][0]%=MOD;
              }else if (A[i]==x){
                  dp[i][1]+=dp[i-1][0];
                  dp[i][0]%=MOD;
              }
          }
          ans=dp[N-1][0];
      }
      cout<<ans<<endl;
  }
problem_description: Statement
  
  The _beauty_ of a sequence a of length n is defined as a_1 \oplus \cdots
  \oplus a_n, where \oplus denotes the bitwise exclusive or (XOR).
  
  You are given a sequence A of length N. Snuke will insert zero or more
  partitions in A to divide it into some number of non-empty contiguous
  subsequences.
  
  There are 2^{N-1} possible ways to insert partitions. How many of them divide
  A into sequences whose beauties are all equal? Find this count modulo
  10^{9}+7.
samples: [{"input": "3\n    1 2 3", "output": "3\n    \n\nFour ways of dividing A shown below satisfy the condition. The condition is\nnot satisfied only if A is divided into (1),(2),(3).\n\n  * (1,2,3)\n  * (1),(2,3)\n  * (1,2),(3)\n\n* * *"}, {"input": "3\n    1 2 2", "output": "1\n    \n\n* * *"}, {"input": "32\n    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0", "output": "147483634\n    \n\nFind the count modulo 10^{9}+7.\n\n* * *"}, {"input": "24\n    1 2 5 3 3 6 1 1 8 8 0 3 3 4 6 6 4 0 7 2 5 4 6 2", "output": "292"}]