#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, t, q;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  cin >> n;
  int a[n + 1];
  map<int, int> m;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    m[a[i]]++;
  }
  vector<pair<int, int>> v;
  int flag = 0;
  for (auto i : m) {
    v.push_back(make_pair(i.first, i.second));
  }
  sort(v.begin(), v.end());
  if (v.size() <= 3) {
    if (m[0] == n)
      flag = 1;
    else if (m[0] == n / 3 && v.size() == 2 && v[1].second == (2 * n) / 3)
      flag = 1;
    else {
      int t = ((v[0].first ^ v[1].first) ^ v[2].first);
      if (v[0].second == n / 3 && v[1].second == n / 3 &&
          v[2].second == n / 3 && t == 0)
        flag = 1;
    }
  }
  if (flag == 1)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
