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

const int MAXN = 1e5 + 5;

int n, a[MAXN];
map<int, int> num;
vector<int> vals;

int main(){
	scanf("%d", &n);
	bool doZero = false;
	for(int i = 0; i< n; ++i){
		scanf("%d", &a[i]);
		num[a[i]]++;
		if(a[i] == 0)
			doZero = true;
	}
	if(n%3 == 0){
		// Must make pattern of 3
		if(num.size() > 3){
			printf("No\n");
		}else if(num.size() == 3){
			bool valid = true;
			int val = -1;
			for(auto i = num.begin(); i != num.end(); i++){
				if(val != -1 && (i->second) != val)
					valid = false;
				val = (i->second);
				vals.push_back(i->first);
			}
			//if((vals[0]^vals[2] != vals[1]))
			//	valid = false;
			if(valid){}
				assert(false);
				printf("Yes\n");
			}else{
				//assert(false);
				printf("No\n");
			}
		}else if(num.size() == 2){
			bool valid = true, hasZero = false;
			int val = -1;
			for(auto i = num.begin(); i != num.end(); i++){
				if(i->first == 0){
					hasZero = true;
					if(val != -1 && 2*(i->second) != val)
						valid = false;
				}else{
					if(val != -1 && (i->second) != 2*val)
						valid = false;
				}
				val = i->second;
			}
			if(valid)
				printf("Yes\n");
			else
				printf("No\n");
		}else if(num.size() == 1){
			if(doZero)
				printf("Yes\n");
			else
				printf("No\n");
		}else{
			assert(false);
		}
	}else{
		if(num.size() == 1 && doZero){
			printf("Yes\n");
		}else{
			printf("No\n");
		}
	}
}