#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> camels(n);
  set<int> xo;
  for (int i = 0; i < n; i++) {
    int j;
    cin >> j;
    camels[i] = j;
    xo.insert(j);
  }
  bool b = true;
  sort(camels.begin(), camels.end());
  if (n % 3 == 0) {
    for (int i = 0; i < camels.size(); i = i + n / 3) {
      set<int> gquiz1;
      for (int 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 (b && xo.size() <= 3) {
      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";
    }
  } else {
    if (xo.size() == 1) {
      if (camels[0] != 0) {
        cout << "Yes";
      }
    } else {
      cout << "No";
    }
  }
  int l;
  cin >> l;
}
