#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF_LL = (long long)1000000007 * 1000000007;
const long long INF_INT = (long long)1000000007;
const double PI = 3.14159265358979323846;
const long long dx[4] = {1, 0, -1, 0};
const long long dy[4] = {0, 1, 0, -1};
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
signed main() {
  long long N;
  cin >> N;
  map<long long, long long> m;
  for (long long i = (0); i < (N); ++i) {
    long long a;
    cin >> a;
    m[a]++;
  }
  if (N % 3 != 0) {
    cout << "No" << endl;
    return 0;
  }
  vector<long long> v;
  long long two = -1;
  for (auto val : m) {
    v.emplace_back(val.first);
    if (val.second != N / 3 && val.second != 2 * N / 3) {
      cout << "No" << endl;
      return 0;
    }
    if (val.second != 2 * N / 3) {
      two = val.first;
    }
  }
  if (two == -1) {
    if (v[0] xor v[1] == v[2] && v[1] xor v[2] == v[0] &&
        v[2] xor v[0] == v[1]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else {
    if (__builtin_popcountll(v[0] + 1) == 1 &&
        __builtin_popcountll(v[1] + 1 && (v[0] == 0 || v[1] == 1))) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}
