#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const long long LINF = 1001002003004005006ll;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  if (N % 3 != 0) {
    cout << "No" << endl;
    return 0;
  }
  vector<int> a, b;
  map<int, int> mp;
  int mx = 0;
  for (int i = 0; i < N; i++) {
    int ia;
    cin >> ia;
    mp[ia]++;
    mx = max(mx, ia);
  }
  int mbit = 0;
  while (mx & (1 << mbit)) mbit++;
  ;
  if (mp.size() != 3 && mp.size() != 2) {
    cout << "No" << endl;
    return 0;
  }
  for (auto& m : mp) {
    a.push_back(m.first);
    b.push_back(m.second);
  }
  if (mp.size() == 2) {
    if (b[0] < b[1])
      a.push_back(a[1]);
    else
      a.push_back(a[0]);
  };
  int ng = 0;
  for (int j = 0; j < mbit; j++) {
    int bit = (1 << j);
    int a0 = a[0] & bit ? 1 : 0;
    int a1 = a[1] & bit ? 1 : 0;
    int a2 = a[2] & bit ? 1 : 0;
    if (a0 == 0 && a1 == 1 && a2 == 1) {
    } else if (a0 == 1 && a1 == 0 && a2 == 1) {
    } else if (a0 == 1 && a1 == 1 && a2 == 0) {
    } else {
      ng = 1;
    }
    if (ng) break;
  }
  if (ng)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
  return 0;
}
