/*input
4
1 2 3 2

*/

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define N 500005

int main() {
	int n;
	cin>>n;
	vector<pair<int,int> > a(5,make_pair(-1,-1));
	int poss = 0;
	int cnt =0;
	
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		int j =0;
		for(j=0;j<cnt;j++){
			if(x == a[j].first) {
				a[j].second ++;
				break;
			}
		}
		if(j!=cnt) continue;
		//cout<<x<<endl;
		a[cnt++] = make_pair(x,1);
		if(cnt > 3){ break;}

		
	}
	//cout<<cnt<<endl;

	if( cnt == 3 && ((a[0].first^a[1].first) == a[2].first)) {
		int maxdiff = abs(a[0].second - a[1].second);
		maxdiff = max(maxdiff , a[1].second - a[2].second);
		maxdiff = max(maxdiff , a[0].second - a[2].second);
		if(maxdiff<=1) poss = 1 ;
	}

	if(n%3 == 2){
		poss = 0;
	}

	if(cnt == 2 && (v[0].first == 0 || v[1].first == 0)) {
		if(abs(v[0].second - v[1].second) < = 1)
		poss =1;
	}
	if(poss) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;

}