#include <bits/stdc++.h>
 
using namespace std;

typedef long long ll;
 
int main(){
	
	ll n ; cin>>n;
	vector<ll>camels(n);
	set<ll>xo;
	for(ll i = 0 ; i< n ; i++){
		ll j ; cin>>j;
		camels[i]=j;
		xo.insert(j);
	}
	bool b = true;

	sort(camels.begin(),camels.end());
	if(n%3==0){

		for(ll i = 0 ; i< n;i=i+n/3){
			set <ll> gquiz1;  
			for(ll j = 0 ; j< n/3 ; j++){
				gquiz1.insert(camels[i+j]);
				
			}
			
			if(gquiz1.size()>1){
				b=false;
				break;
			}
			
		}

		
		

		if(xo.size()==1){
			if(camels[0]==0){
				cout<<"Yes";
			}
		}
		else if (xo.size()==2){
			ll num=0;
			for(int i = 0 ; i< camels.size() ; i++){
				if(camels[i]==0){
					num++;
				}
			}
			if(num==n/3){
				cout<<"Yes";
			}
			else{
				cout<<"No";
			}
		}
		else if(xo.size()==3){
			for(int i = 0 ; i< camels.size()-1;i++){
				if(camels[i]==camels[i+1]){
					camels.erase(camels.begin()+i);
					i--;
				}
			}
			vector<string>binary(3);
			ll maxlen=0;
			for(int i = 0 ; i< 3 ; i++){
				string bin = bitset<64>(camels[i]).to_string();
				binary[i]=bin;
				ll binsize=0;
				for(ll j = 0 ; j<64 ; j++){
					if(bin[j]=='1'){
						binsize=64-j;
						break;
					}
				}
				if(binsize>maxlen){
					maxlen=binsize;
				}
			}
		
			vector<ll>counting(64,0);
			for(int i = 0 ; i< 3 ; i++){
				for(ll j = 63 ; j>=64-maxlen ; j--){
					if(binary[i][j]=='1'){
						counting[j]++;
					}
				}
			}
			bool ans=true;
			for(int i = 63 ; i>=64-maxlen ; i--){
				if(counting[i]!=2){
					ans=false;
				}
				
			}
			
			if(ans){
				cout<<"Yes";
			}
			else{
				cout<<"No";
			}
		}
		else{
			cout<<"No";
		}
	}

	else{
		if(xo.size()==1){
			if(camels[0]==0){
				cout<<"Yes";
			}
		}
		else{
			cout<<"No";
		}
	}
	int l ; cin>>l;
}
