#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
constexpr int MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<lint> a(N);
  for (int i = (0), i_end_ = (N); i < i_end_; i++) cin >> a[i];
  bool f = true;
  for (int i = (0), i_end_ = (N); i < i_end_; i++) {
    if (a[i] != 0) {
      f = false;
      break;
    }
  }
  if (f) {
    cout << "Yes" << endl;
    return 0;
  }
  if (N % 3 == 0) {
    vector<lint> b(3, -1);
    vector<lint> c(3, 0);
    for (int i = (0), i_end_ = (N); i < i_end_; i++) {
      bool flg = false;
      for (int j = (0), j_end_ = (4); j < j_end_; j++) {
        if (j == 3) {
          cout << "No" << endl;
          return 0;
        }
        if (b[j] == -1) {
          b[j] = a[i];
          c[j]++;
          flg = true;
        } else if (b[j] == a[i]) {
          c[j]++;
          flg = true;
        }
        if (flg) {
          break;
        }
      }
    }
    for (int j = (0), j_end_ = (3); j < j_end_; j++) {
      if (c[j] != c[0]) {
        cout << "No" << endl;
        return 0;
      }
    }
    for (int i = (0), i_end_ = (32); i < i_end_; i++) {
      int cnt = 0;
      for (int j = (0), j_end_ = (3); j < j_end_; j++) {
        if ((b[j] >> i) & 1 == 1) {
          cnt++;
        }
      }
      if (cnt == 1 || cnt == 3) {
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}
