#include "pch.h"
#include "bits/stdc++.h"

typedef long long ll;
typedef long long int lli;
const int MOD = 1000000007;
#define rep(i,n) for (int i = 0; i < (n); i++)

using namespace std;

int binary(ll bina) {
	ll ans = 0;
	for (ll i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2)*pow(10, i);
		bina = bina / 2;
	}
	return ans;
}

int main() {
	cin.tie(0); ios::sync_with_stdio(false);

	ll N; cin >> N;
	vector<ll> ver(N);
	rep(i, N) { cin >> ver[i]; }

	vector<ll> S(N);
	rep(i, N) { S[i] = binary(ver[i]); }

	for (ll x = 1; x < N - 1; x++)
	{
		ll A = ver[x - 1] ^ ver[x + 1];
		if (binary(A) != S[x]) {
			cout << "No" << endl;
			return 0;
		}
	}

	ll A = ver[N - 1] ^ ver[1];
	if (binary(A) != S[0]) {
		cout << "No" << endl;
		return 0;
	}
	A = ver[N - 2] ^ ver[0];
	if (binary(A) != S[N - 1]) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
}