#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int main(void){
  int n,ai,i,j,t=0,k=1;
  cin >> n;
  vector<P> ab;
  for (i=0;i<n;i++){
    cin >> ai;
    for (j=t-1;j>=0;j--) if (ab.at(j).first==ai) break;
    if (j>=0) ab.at(j).second++;
    else{
      t++;
      ab.push_back(P(ai,1));
    }
    if (t>3){
      cout << "No" << endl;
      return 0;
    }
  }
  if (ab.at(0)==P(0,n)){
    cout << "Yes" << endl;
    return 0;
  }
  sort(m.begin(),m.end());
  if (t==2 && ab.at(0)==P(0,n*2/3)){
    cout << "Yes" << endl;
    return 0;
  }
  if (t!=3){
    cout << "No" << endl;
    return 0;
  }
  int a,b,c;
  vector<int> m;
  for (i=0;i<3;i++){
    if (ab.at(i).second*3!=n){
      cout << "No" << endl;
      return 0;
    }
    m.push_back(ab.at(i).first);
  }
  for (i=0;i<31;i++){
    a=(m.at(0) & k);
    b=(m.at(1) & k);
    c=(m.at(2) & k);
    if (a+b+c!=2*k && a+b+c!=0) break;
    k*=2;
  }
  if (i==31) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}