#include <bits/stdc++.h>
using namespace std;
const long long INF = (long long)1e9;
const long long MOD = (long long)1e9 + 7;
const long long MAX = 510000;
vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  long long N;
  cin >> N;
  if (N % 3 != 0) {
    cout << "No" << endl;
    return 0;
  }
  map<long long, long long> m;
  vector<long long> a(N);
  for (long long i = 0; i < N; i++) {
    cin >> a[i];
    m[a[i]]++;
  }
  sort(a.begin(), a.end());
  if (m[0] == N) {
    cout << "Yes" << endl;
    return 0;
  }
  if (m[0] == N * 2 / 3 && m[a[N - 1]] == N / 3) {
    cout << "Yes" << endl;
    return 0;
  }
  long long cnt = 0;
  for (long long i = 0; i < N; i++) {
    if (m[a[i]] != N / 3) {
      cout << "No" << endl;
      return 0;
    }
  }
  bitset<30> b1(a[0]), b2(a[N / 3]), b3(a[N - 1]), a1, a2, a3;
  a1 = b2 ^ b3;
  a2 = b1 ^ b3;
  a3 = b1 ^ b2;
  if (a1 == b1 || a2 == b2 || a3 == b3) {
    if (m[a[0]] == N / 3 && m[a[N - 1]] == N / 3) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}
