#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;
using vecint = vector<int>;
using ll = int64_t;
constexpr ll MOD = 1000000007;

ll powmod(ll x, ll i) {
  ll res = 1;
  REP(j,i) {
    res *= x;
    res %= MOD;
  }
  return res;
}

int main()
{
  int n;
  cin>>n;
  vecint a(n);
  REP(i,n) cin>>a[i];
  vector<ll> sum(1<<20);
  vector<ll> oldsum(1<<20, 1);
  vector<ll> cnt(1<<20);
  vector<ll> dp(n);
  int x = 0;
  int zeros = 0;
  vector<pair<int, int>> v;
  REP(i,n) {
    x ^= a[i];
    if (x == 0) {
      for (auto p : v) {
        int j, y;
        tie(j, y) = p;
        oldsum[y] = dp[j];
        sum[y] += dp[j];
        sum[y] %= MOD;
        cnt[y] = zeros;
      }
      v.clear();
      ++zeros;
    } else {
      dp[i] = (zeros - cnt[x]) * sum[x];
      dp[i] %= MOD;
      dp[i] += oldsum[x];
      dp[i] %= MOD;
      v.emplace_back(i, x);
    }
  }
  ll res;
  if (x == 0) {
    res = powmod(2, zeros-1);
    FOR(i,1,1<<20) {
      res += sum[i];
      res %= MOD;
    }
  } else {
    res = dp.back();
  }
  cout << res << endl;
  return 0;
}
