#include<bits/stdc++.h>
#define reg register
#define rep(i, a, b) for (reg int i = (a), i##end = (b); i <= i##end; ++i)
#define dep(i, a, b) for (reg int i = (a), i##end = (b); i >= i##end; --i)
using namespace std;
using ll = long long;

signed main() {
	ll n;
	cin>>n;
	vector<ll> p(n);
	rep(i, 0, n-1) {
		cin>>p[i];
	}
	ll a[3], b[3];
	int x = n % 3;
	rep(i, 1, n-1) {
		rep(l, 0, 2) {
			b[l] = 0;
		}
		a[0] = p[0];
		a[1] = p[i];
		a[2] = a[0] xor a[1];
		rep(l, 0, n-1) {
			if (p[l] == a[0]) ++b[0];
			if (p[l] == a[1]) ++b[1];
			if (p[l] == a[2]) ++b[2];
		}
		if (
				(
				 (b[0] == n / 3 + (x > 0) ? 1 : 0) &&
				 (b[1] == n / 3 + (x > 1) ? 1 : 0) &&
				 (b[2] == n / 3)
				) ||
				(
				 (b[0] == n / 3 + (x > 0) ? 1 : 0) &&
				 (b[2] == n / 3 + (x > 1) ? 1 : 0) &&
				 (b[1] == n / 3)
				) ||
				(
				 (b[1] == n / 3 + (x > 0) ? 1 : 0) &&
				 (b[0] == n / 3 + (x > 1) ? 1 : 0) &&
				 (b[2] == n / 3)
				) ||
				(
				 (b[1] == n / 3 + (x > 0) ? 1 : 0) &&
				 (b[2] == n / 3 + (x > 1) ? 1 : 0) &&
				 (b[0] == n / 3)
				) ||
				(
				 (b[2] == n / 3 + (x > 0) ? 1 : 0) &&
				 (b[0] == n / 3 + (x > 1) ? 1 : 0) &&
				 (b[1] == n / 3)
				) ||
				(
				 (b[2] == n / 3 + (x > 0) ? 1 : 0) &&
				 (b[1] == n / 3 + (x > 1) ? 1 : 0) &&
				 (b[0] == n / 3)
				) 
				)
				{
					cout << "Yes" << endl;
					return 0;
				}
	}
	cout << "No" << endl;
}
