#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> camels(n);
  for (int i = 0; i < n; i++) {
    int j;
    cin >> j;
    camels[i] = j;
  }
  bool b = true;
  sort(camels.begin(), camels.end());
  for (int i = 0; i < camels.size(); i++) {
    set<int> gquiz1;
    for (int j = 0; j < n / 3; j++) {
      gquiz1.insert(camels[i + j]);
    }
    if (gquiz1.size() > 1) {
      b = false;
      break;
    }
    i = i + n / 3 - 1;
  }
  for (int i = 0; i < camels.size() - 1; i++) {
    if (camels[i] == camels[i + 1]) {
      camels.erase(camels.begin() + i);
    }
  }
  if (camels.size() == 3 && b) {
    vector<string> binary(3);
    int maxlen = 0;
    for (int i = 0; i < 3; i++) {
      string bin = bitset<32>(camels[i]).to_string();
      binary[i] = bin;
      int binsize;
      for (int j = 0; j < 32; j++) {
        if (bin[j] == '1') {
          binsize = 32 - j;
          break;
        }
      }
      if (binsize > maxlen) {
        maxlen = binsize;
      }
    }
    vector<int> counting(32, 0);
    for (int i = 0; i < 3; i++) {
      for (int j = 31; j >= 32 - maxlen; j--) {
        if (binary[i][j] == '1') {
          counting[j]++;
        }
      }
    }
    bool ans = true;
    for (int i = 31; i >= 32 - maxlen; i--) {
      if (counting[i] != 2) {
        ans = false;
      }
    }
    if (ans) {
      cout << "Yes";
    } else {
      cout << "No";
    }
  } else {
    cout << "No";
  }
}
