#include <bits/stdc++.h>
using namespace std;
signed main() {
  bool ans = false;
  int64_t N;
  cin >> N;
  map<int64_t, int64_t> mp;
  for (int64_t i = (0); i < (N); i++) {
    int64_t x;
    cin >> x;
    mp[x]++;
  }
  if (N % 3 != 0) {
    if (mp.size() == 1 && mp[0] == N) cout << "Yes" << endl;
  } else {
    if (mp.size() == 1 && mp[0] == N) {
      cout << "Yes" << endl;
    } else if (mp.size() == 2) {
      auto it = mp.begin();
      int64_t x = it->second;
      it++;
      int64_t y = it->second;
      if (x > y) swap(x, y);
      if (x == N / 3 && y == 2 * N / 3 && x ^ y ^ y == 0) cout << "Yes" << endl;
    } else if (mp.size() == 3) {
      auto it = mp.begin();
      int64_t x = it->second;
      it++;
      int64_t y = it->second;
      it++;
      int64_t z = it->second;
      if (x == N / 3 && y == N / 3 && z == N / 3 && x ^ y ^ z == 0)
        cout << "Yes" << endl;
    }
  }
  cout << (ans ? "Yes" : "No") << endl;
  return 0;
}
