#include <bits/stdc++.h>
using namespace std;
using LLONG = long long;
const bool IsAllOne(const LLONG x) {
  if (x == 1) {
    return true;
  }
  if (x % 2 == 0) {
    return false;
  }
  return IsAllOne(x / 2);
}
const vector<LLONG> GetExistingValues(const vector<LLONG> &hats) {
  set<LLONG> values;
  for (const LLONG hat : hats) {
    values.insert(hat);
  }
  vector<LLONG> ret;
  for (const auto value : values) {
    ret.push_back(value);
  }
  return ret;
}
int main() {
  int N;
  cin >> N;
  vector<LLONG> hats(N);
  for (int i = 0; i < N; ++i) {
    cin >> hats[i];
  }
  map<LLONG, LLONG> valueCounts;
  for (const LLONG hat : hats) {
    ++valueCounts[hat];
  }
  sort(hats.begin(), hats.end());
  if (valueCounts.size() >= 4) {
    cout << "No" << endl;
    return 0;
  }
  if (valueCounts.size() == 1) {
    if (valueCounts.find(0) != valueCounts.end()) {
      cout << "Yes" << endl;
      return 0;
    } else {
      cout << "No" << endl;
      return 0;
    }
  } else if (valueCounts.size() == 2) {
    if (valueCounts.find(0) == valueCounts.end()) {
      cout << "No" << endl;
      return 0;
    }
    if (N % 3 != 0 || valueCounts[0] != N / 3) {
      cout << "No" << endl;
      return 0;
    }
    if (hats.front() == 0 && IsAllOne(hats.back())) {
      cout << "Yes" << endl;
      return 0;
    } else {
      cout << "No" << endl;
      return 0;
    }
  } else if (valueCounts.size() == 3) {
    if (N % 3 != 0) {
      cout << "No" << endl;
      return 0;
    }
    vector<LLONG> values = GetExistingValues(hats);
    for (const LLONG value : values) {
      if (valueCounts[value] != N / 3) {
        cout << "No" << endl;
        return 0;
      }
    }
    for (int i = 0; i < 3; ++i) {
      if ((values[i] ^ values[(i + 2) % 3]) != values[(i + 1) % 3]) {
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;
  }
}
