#include <bits/stdc++.h>
using namespace std;
inline long long isqrt(long long k) {
  long long r = sqrt(k) + 1;
  while (r * r > k) r--;
  return r;
}
inline long long icbrt(long long k) {
  long long r = cbrt(k) + 1;
  while (r * r * r > k) r--;
  return r;
}
inline long long minize(long long& a, long long b) {
  return a = (a > b ? b : a);
}
inline long long maxize(long long& a, long long b) {
  return a = (a < b ? b : a);
}
inline string toString(long long n) {
  stringstream ss;
  ss << n;
  return ss.str();
}
double const eps = 1e-6;
long long const Base = 1e9 + 7, oo = 1e17, MAXN = 1e6;
long long A[MAXN + 5];
map<long long, long long> mymap;
long long Solves() {
  long long n, m, k, cnt = 0, ans = 0, x, y, q, c, sum = 0, v, t;
  cin >> n;
  vector<long long> vec;
  for (long long i = 0; i <= n - 1; i++) {
    cin >> A[i];
    mymap[A[i]]++;
    vec.push_back(A[i]);
  }
  if (n % 3 != 0) {
    if (mymap[A[0]] == n) return cout << "Yes" << endl, 0;
    return cout << "No" << endl, 0;
  }
  sort((vec).begin(), (vec).end());
  (vec).erase(unique((vec).begin(), (vec).end()), (vec).end());
  vector<long long> vec2;
  for (long long i = 0; i < vec.size(); i++) {
    if (mymap[vec[i]] % (n / 3) != 0) return cout << "No" << endl, 0;
    for (long long j = 1; j <= mymap[vec[i]] / (n / 3); j++)
      vec2.push_back(vec[i]);
  }
  assert((long long)vec2.size() == 3);
  if (vec2[0] ^ vec2[1] == vec2[2] or vec2[0] ^ vec2[2] == vec2[1] or
      vec2[2] ^ vec2[1] == vec2[0])
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
int main() {
  long long JUDGE_ONLINE = 1;
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long test = 1;
  for (long long T = 1; T <= test; T++) {
    Solves();
  }
  if (!JUDGE_ONLINE)
    cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
}
