#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <cassert>
using namespace std;
using ll = long long;

// Modint
struct Mint {
	static const ll mod = (ll)(1e9 + 7);
	ll val;

	Mint() { val = 0; }
	Mint(ll a) { val = a; verify_value(); }

	void verify_value() {
		if (val >= mod) val %= mod;
		if (val < 0) val %= mod, val += mod;
	}

	Mint pow(ll p) const {
		Mint cur = Mint(val), ret = 1;
		while (p > 0) {
			if (p & 1) ret *= cur;
			cur *= cur;
			p >>= 1LL;
		}
		return ret;
	}
	Mint inv() const {
		if (val == 0) cerr << "CAUTION: inv() is called with 0." << endl;
		return pow(mod - 2);
	}

	Mint operator+() const { return *this; }
	Mint operator-() const { return Mint(mod - val); }

	Mint operator+=(const Mint &a) {
		val += a.val;
		if (val >= mod) val -= mod;
		return Mint(val);
	}
	Mint operator*=(const Mint &a) {
		val *= a.val;
		if (val >= mod) val %= mod;
		return Mint(val);
	}
	Mint operator-=(const Mint &a) { return *this += -a; }
	Mint operator/=(const Mint &a) { return *this *= a.inv(); }

	Mint operator++() { return *this += Mint(1); }
	Mint operator--() { return *this -= Mint(1); }
	Mint operator++(int) {
		Mint ret = *this;
		++(*this);
		return ret;
	}
	Mint operator--(int) {
		Mint ret = *this;
		--(*this);
		return ret;
	}

	operator ll() const { return val; }
};

Mint operator+(const Mint &a, const Mint &b) {
	ll ret = a.val + b.val;
	if (ret >= Mint::mod) ret -= Mint::mod;
	return Mint(ret);
}
Mint operator*(const Mint &a, const Mint &b) {
	ll ret = a.val * b.val;
	if (ret >= Mint::mod) ret %= Mint::mod;
	return Mint(ret);
}
Mint operator-(const Mint &a, const Mint &b) { return a + (-b); }
Mint operator/(const Mint &a, const Mint &b) { return a * b.inv(); }

ostream &operator<<(ostream &out, const Mint &a) { return out << a.val; }
istream &operator>>(istream &in, Mint &a) {
	in >> a.val;
	a.verify_value();
	return in;
}


int main() {
	int n; cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	int la = 0;
	for (int i = 0; i < n; i++) la ^= a[i];

	if (la != 0) {
		vector<int> b;
		int cur = 0;
		for (int i = 0; i < n; i++) {
			cur ^= a[i];
			if (cur == la) b.push_back(la);
			else if (cur == 0) {
				if (b.empty() || b.back() > 0) b.push_back(-1);
				else b.back()--;
			}
		}
		int m = b.size();
		vector<vector<Mint>> dp(m + 1, vector<Mint>(2));
		dp[0][0] = 1;
		for (int i = 0; i < m; i++) {
			dp[i + 1][0] += dp[i][0];
			dp[i + 1][1] += dp[i][1];
			if (b[i] < 0) dp[i + 1][0] += Mint(-b[i])*dp[i][1];
			else dp[i + 1][1] += dp[i][0];
		}
		cout << dp[m][0] << endl;
	}
	else {
		map<int, vector<int>> ids;
		vector<int> sum(n + 2);
		int cur = 0;
		for (int i = 0; i < n; i++) {
			cur ^= a[i];
			if (cur == 0) {
				sum[i + 1] = 1;
			}
			else {
				ids[cur].push_back(i);
			}
		}
		for (auto &p : ids) p.second.push_back(n);
		for (int i = 1; i <= n; i++) sum[i] += sum[i - 1];
		auto func = [&](int x) {
			const auto &id = ids[x];
			int m = id.size() - 1;
			vector<vector<Mint>> dp(2*m + 5, vector<Mint>(2));
			dp[0][0] = 1;
			for (int i = 0; i < m; i++) {
				dp[2 * i + 1][0] += dp[2 * i][0];
				dp[2 * i + 1][1] += dp[2 * i][1];
				dp[2 * i + 1][1] += dp[2 * i][0];
				
				dp[2 * i + 2][0] += dp[2 * i + 1][0];
				dp[2 * i + 2][1] += dp[2 * i + 1][1];
				dp[2 * i + 2][0] += Mint(sum[id[i + 1]] - sum[id[i]])*dp[2 * i + 1][1];
			}
			return dp[2 * m][1];
		};
		Mint ans = 0;
		for (const auto &p : ids) {
			ans += func(p.first);
		}
		cur = 0;
		Mint cnt = 0;
		for (int i = 0; i < n; i++) {
			cur ^= a[i];
			if (cur == 0) cnt++;
		}
		ans += Mint(2).pow((ll)cnt - 1);
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 35584