#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;

struct SegT {
private:
	int sz; vector<ll> node;
	const ll init_c = 0;
public:
	void init(int n) {
		sz = 1;
		while (sz < n)sz *= 2;
		node.resize(2 * sz - 1, init_c);
	}
	ll f(ll a, ll b) {
		return (a + b) % mod;
	}
	void update(int k, ll a) {
		k += sz - 1;
		node[k] = a;
		while (k > 0) {
			k = (k - 1) / 2;
			node[k] = f(node[k * 2 + 1], node[k * 2 + 2]);
		}
	}
	ll query(int a, int b, int k = 0, int l = 0, int r = -1) {
		if (r < 0)r = sz;
		if (r <= a || b <= l)return init_c;
		else if (a <= l && r <= b)return node[k];
		else {
			ll vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
			ll vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
			return f(vl, vr);
		}
	}
};

ll rsum[1 << 20];
ll cur[1 << 20];
vector<int> vc[1 << 20];

int ra[1 << 19];
void solve() {
	int n; cin >> n;
	vector<int> a(n);
	int x = 0;
	rep(i, n) {
		cin >> a[i];
		x ^= a[i];
		ra[i + 1] = ra[i] ^ a[i];
	}
	//cout << x << endl;
	if (x > 0) {
		vector<int> vx,v0;
		rep(i, n+1) {
			if (ra[i] == x) {
				vx.push_back(i);
			}
			else if (ra[i] == 0) {
				v0.push_back(i);
			}
		}
		SegT sx, s0;
		//cout << vx.size() << v0.size() << endl;
		rep(i, 1) {
			sx.init(vx.size());
			s0.init(v0.size());
		}
		s0.update(0, 1);
		rep1(i, n) {
			if (ra[i] == 0) {
				int id = lower_bound(vx.begin(), vx.end(), i) - vx.begin();
				ll z = sx.query(0, id);
				int loc = lower_bound(v0.begin(), v0.end(), i) - v0.begin();
				//cout << "0 " << loc<< endl;
				s0.update(loc, z);
				//cout << i << endl;
			}
			else if (ra[i] == x) {
				int id = lower_bound(v0.begin(), v0.end(), i) - v0.begin();
				ll z = s0.query(0, id);
				int loc = lower_bound(vx.begin(), vx.end(), i) - vx.begin();
				//cout << loc << " x" << endl;
				sx.update(loc, z);
				//cout << i << endl;
			}
		}
		int len = vx.size();
		ll ans = sx.query(len - 1, len);
		cout << ans << endl;
	}
	else {
		rep(i, n+1) {
			vc[ra[i]].push_back(i);
		}
		rep1(i, (1 << 20) - 1) {
			cur[i] = 1;
		}
		rep1(i, n-1) {
			if (ra[i] == 0)continue;
			int num;
			if (vc[ra[i]][0] == i)num = 0;
			else {
				int now = lower_bound(vc[ra[i]].begin(), vc[ra[i]].end(), i) - vc[ra[i]].begin();
				int le = vc[ra[i]][now - 1], ri = vc[ra[i]][now];
				num = lower_bound(vc[0].begin(), vc[0].end(), ri) - lower_bound(vc[0].begin(), vc[0].end(), le);
				
			}
			cur[ra[i]] = (cur[ra[i]] + num * rsum[ra[i]]) % mod;
			rsum[ra[i]] = (rsum[ra[i]] + cur[ra[i]]) % mod;
		}
		ll ans = 0;
		rep1(i, (1 << 20) - 1) {
			if (vc[i].size() == 0)continue;
			int num;
				int le = vc[i].back();
				num = lower_bound(vc[0].begin(), vc[0].end(), n) - lower_bound(vc[0].begin(), vc[0].end(), le);
			
			//cur[i] = (cur[i] + num * rsum[i]) % mod;
			ans += rsum[i]; if (ans >= mod)ans -= mod;
		
		}
		int cnt = 0;
		rep1(i, n - 1)if (ra[i] == 0)cnt++;
		ll ss = 1; rep(i, cnt)ss = ss * 2 % mod;
		ans = (ans + ss) % mod;
		cout << ans << endl;

		rep(i, n + 1) {
			//cout << ra[i] << endl;
		}
		//cout << rsum[1] << endl;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	//stop
	return 0;
}


Measured memory_bytes: 54772