#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];
	}
	vector<ll> q(n);
	q[0] = p[0];
	rep(j, 1, n-1) {
		q[1] = p[j];
		rep(i, 2, n-1+2) {
			q[i % n] = q[(i-2)%n] xor q[(i-1)%n];
		}
		sort(p.begin(), p.end());
		sort(q.begin(), q.end());
		rep(i, 0, n-1) {
			if (q[i] != p[i]) {
				goto next;
			}
		}
		cout<<"Yes"<<endl;
		return 0;
next:
		;
	}
	cout<<"No"<<endl;
}
