#include<cstdio>
#include<cstring>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<bitset>
#include<random>
#include<unistd.h>
//This code is written by Itst
using namespace std;

int read(){
	int a = 0; char c = getchar(); bool f = 0;
	while(!isdigit(c)){f = c == '-'; c = getchar();}
	while(isdigit(c)){
		a = a * 10 + c - 48; c = getchar();
	}
	return f ? -a : a;
}

signed main(){
#ifndef ONLINE_JUDGE
	//freopen("in","r",stdin);
	//freopen("out","w",stdout);
#endif
	int N = read(); int len = N / __gcd(3 , N);
	map < int , int > pot; vector < int > now;
	for(int i = 1 ; i <= N ; ++i){
		int t = read();
		if(++pot[t] == len)
			now.push_back(t);
	}
	if(now.size() * len != N){puts("No"); return 0;}
	if(now.size() == 1 && now[0] != 0 || now.size() == 3 && (now[0] ^ now[1] ^ now[2])){
		puts("No"); return 0;
	}
	puts("Yes");
	return 0;
}