#include <bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define rep(i,n) for(int i=0; i<(int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

unordered_map<ll, ll> minvmap;
ll minv(ll a, ll m) {
  auto k = a; auto p = minvmap[a]; if (p != 0) return p;
  ll b = m, u = 1, v = 0;
  while (b) { ll t = a/b; swap(a -= t*b, b); swap(u -= t*v, v); }
  p = (u%m+m)%m; minvmap[k] = p; return p;
}
struct mint {
    ll x;
    mint():x(0){}
    mint(ll x):x((x%mod+mod)%mod){}
    mint& fix() { x = (x%mod+mod)%mod; return *this;}
    mint operator-() const { return mint(0) - *this;}
    mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
    mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
    mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
    mint& operator/=(const mint& a){ (x*=minv(a.x, mod))%=mod; return *this; }
    mint operator+(const mint& a)const{ return mint(*this) += a;}
    mint operator-(const mint& a)const{ return mint(*this) -= a;}
    mint operator*(const mint& a)const{ return mint(*this) *= a;}
    mint operator/(const mint& a)const{ return mint(*this) /= a;}
    bool operator<(const mint& a)const{ return x < a.x;}
    bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}

mint mod_pow(mint a, ll x) {
  mint res = 1;
  while(x > 0) {
    if (x & 1) res *= a;
    a *= a; x >>= 1;
  }
  return res;
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n; cin >> n;
  vector<unsigned int> a(n);
  unsigned int sum = 0;
  rep(i, n) {
    cin >> a[i];
    sum ^= a[i];
  }

  if (sum!=0) {
    unsigned int now = 0;
    deque<unsigned int> vec;
    rep(i, n) {
      now ^= a[i];
      if (now == sum) {
        vec.push_back(sum);
      } else if (now == 0) {
        vec.push_back(0);
      }
    }
    while(!vec.empty() && vec.front() == 0) {
      vec.pop_front();
    }
    while(!vec.empty() && vec.back() == sum) {
      vec.pop_back();
    }
    mint ans = 1;
    mint nowa = 0;
    for(auto e: vec) {
      if (e==sum) {
        nowa += ans;
      } else {
        ans += nowa;
      }
    }
    cout << ans << endl;
    return 0;
  }

  unsigned int now = 0;
  int z = 0;
  unordered_map<int, mint> zero;
  unordered_map<int, mint> ans;
  unordered_map<int, int> zcnt;
  rep(i, n) {
    now ^= a[i];
    zero[now] = 1;
  }

  rep(i, n) {
    now ^= a[i];
    if (now == 0) {
      z++;
    }
    if (now != 0) {
      int znum = z - zcnt[now];
      zero[now] += ans[now]*znum;
      ans[now] += zero[now];
    }
    zcnt[now] = z;
  }



  mint ret = 0;
  for(auto e: ans) {
    ret += e.second;
  }

  ret += mod_pow(2, z-1);

  cout << ret << endl;
}

Measured memory_bytes: 43380