#include <bits/stdc++.h>
using namespace std;
int n,a[200005];
main (){
	cin>>n;
	
	for (int i=1; i<=n; i++) {
		cin>>a[i];
		a[i+n]=a[i];
	}
	
	for (int i=2; i<2*n; i++) {
		if (a[i-1]^a[i]!=a[i+1]) {
			cout<<"No\n";
			return 0;
		}
	}
	
	cout<<"Yes\n";
}