#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1000000007;
int main() {
  int n;
  cin >> n;
  map<int, int> mp;
  for (int i = 0; i < (n); i++) {
    int x;
    cin >> x;
    mp[x]++;
  }
  bool ok = true;
  if (mp.size() > 3)
    ok = false;
  else if (mp.size() == 1) {
    if (!mp.count(0)) ok = false;
  } else if (mp.size() == 2) {
    if (n % 3 != 0)
      ok = false;
    else if (mp.at(0) != n / 3)
      ok = false;
  } else {
    if (n % 3 != 0) ok = false;
    vector<int> a;
    for (auto p : mp) {
      if (p.second != n / 3) ok = false;
      a.push_back(p.first);
    }
    if (a[0] ^ a[1] != a[2] && a[0] ^ a[2] != a[1] && a[1] ^ a[2] != a[0])
      ok = false;
  }
  cout << (ok ? "Yes" : "No") << endl;
}
