#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const int SIZE = 1e5 + 9;
int n;
map<ll, int> a;
void No() {
  cout << "No" << endl;
  exit(0);
}
void Yes() {
  cout << "Yes" << endl;
  exit(0);
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    ll tmp;
    cin >> tmp;
    a[tmp]++;
  }
  int sz = a.size();
  if (a[0] != 0) {
    if (sz == 1) Yes();
    if (sz != 2) No();
    if (a[0] * 3 != n) No();
    Yes();
  }
  if (sz != 3) No();
  for (auto x : a) {
    if (x.first == 0) continue;
    if (x.second * 3 != n) No();
  }
  vector<ll> a3;
  for (auto x : a) {
    if (x.first == 0) continue;
    a3.push_back(x.first);
  }
  if (a3[0] ^ a3[1] == a3[2] || a3[0] ^ a3[2] == a3[1]) {
    Yes();
  }
  No();
}
