#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const ll INF = 1e9 + 7;
const ll MOD = 1e9 + 7;

int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };




//ユークリッド互除法
template<typename T>
T gcd(T x, T y) {

	if (y == 0) {
		return x;
	}
	else {
		return gcd(y, x % y);
	}
}
/*最小公倍数*/
template<typename T>
T lcm(T x, T y) {
	T tmp = gcd(x, y);
	return (x / tmp) * y;
}


struct Combination {

	vector<ll> fact, rfact;

	Combination(ll sz) : fact(sz + 1), rfact(sz + 1) {

		fact[0] = 1;
		for (ll i = 1; i < fact.size(); i++) {
			fact[i] = fact[i - 1] * i % MOD;
		}
		//逆元
		rfact[sz] = inv(fact[sz]);
		for (ll i = sz - 1; i >= 0; i--) {
			rfact[i] = rfact[i + 1] * (i + 1) % MOD;
		}
	}

	ll inv(ll x) {
		return pow(x, MOD - 2);
	}
	ll pow(ll x, ll n) {
		ll ret = 1;
		while (n > 0) {
			if (n & 1) (ret *= x) %= MOD;
			(x *= x) %= MOD;
			n >>= 1;
		}
		return (ret);
	}
	ll P(ll n, ll r) {
		if (r < 0 || n < r) return (0);
		return (fact[n] * rfact[n - r] % MOD);
	}

	ll C(ll p, ll q) {
		if (q < 0 || p < q) return (0);
		return (fact[p] * rfact[q] % MOD * rfact[p - q] % MOD);
	}

	ll H(ll n, ll r) {
		if (n < 0 || r < 0) return (0);
		return (r == 0 ? 1 : C(n + r - 1, r));
	}
};


/******************************************************************************************/


int main() {


	ll n;
	cin >> n;
	vector<ll> a(n);
	map<ll, ll> mp;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		mp[a[i]]++;
	}

	if (mp.size() == 3) {
		vector<ll> a;
		for (auto it:mp)
		{
			a.push_back(it.first);
			if (it.second * 3 != n) {
				cout << "No" << endl;
				return 0;
			}
		}
		//cout << "a" << endl;
		//cout << a.size() << endl;
		for (int i = 0; i < 3; i++)
		{
			if ((a[(i + 3 - 1) % 3] ^ a[(i + 3 + 1) % 3]) != a[i]) {
				cout << "No" << endl;
				return 0;
			}
		}
		cout << "Yes" << endl;
		return 0;
	}
	else if (mp.size() == 2) {

		//cout << "a" << endl;
		ll zero = 0;
		ll other = 0;
		bool flag = false;
		for (auto hoge : mp) {
			if (hoge.first == 0) {
				zero += hoge.second;
			}
			else
			{
				if (hoge.first != 1) {
					flag = true;
				}
				other += hoge.second;
			}
		}

		if (flag) {

			if (zero * 2 == other) {
				cout << "Yes" << endl;
			}
			else
			{
				cout << "No" << endl;
			}
			return 0;
		}
		else
		{
			if (abs(mp[1] - mp[0]) == 1) {
				cout << "Yes" << endl;
			}
			else
			{
				cout << "No" << endl;
			}
			return 0;
		}
		
	}
	else
	{
		for (int i = 0; i < n; i++)
		{
			//cout << a[(i + n - 1) % n] << " " << a[(i + n + 1) % n] << endl;
			if ((a[(i + n - 1) % n] ^ a[(i + n + 1) % n]) != a[i]) {
				cout << "No" << endl;
				return 0;
			}
		}
		cout << "Yes" << endl;
	}
	






	return 0;
}


Measured memory_bytes: 5632