#include <bits/stdc++.h>
using namespace std;
constexpr int md = 1e9 + 7;
inline void mad(int &a, int b) {
  a += b;
  if (a >= md) a -= md;
}
inline void mub(int &a, int b) {
  a -= b;
  if (a < 0) a += md;
}
inline int mul(int a, int b) {
  return (int)((long long)a * b % md);
}
inline int mow(int a, long long b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mul(res, a);
      b--;
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}
inline int inv(int a) {
  a %= md;
  if(a < 0) a += md;
  int b = md, u = 0, v = 1;
  while (a) {
    int t = b / a;
    b -= a * t; swap(a, b);
    u -= v * t; swap(u, v);
  }
  assert(b == 1);
  if(u < 0) u += md;
  return u;
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i]; a[i] ^= a[i - 1];
  }
  constexpr int amx = 1 << 20;
  vector<int> dp(amx, 1), ep(amx, 0), prv(amx, 0); int cnt(0);
  for (auto const& crr : a) {
    if (!crr) cnt++;
    else {
      mad(dp[crr], mul(cnt - prv[crr], ep[crr]));
      mad(ep[crr] , dp[crr]);
      prv[crr] = cnt;
    }
  }
  if (a[n]) {
    cout << dp[a[n]] << endl;
    return 0;
  }
  int ret = 0;
  for (int i = 0; i < amx; i++) mad(ret, ep[i]);
  mad(ret, mow(2, cnt - 2));
  cout << ret << endl;
  return 0;
}