#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const long long INF32 = 1e9;
const long long MOD = 1e9 + 7;
const long long MOD2 = (long long)MOD * (long long)MOD;
const long double PI = acos(-1.0L);
const long double EPS = static_cast<long double>(1e-9);
const long long day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const long long dx[4] = {0, 1, 0, -1};
const long long dy[4] = {1, 0, -1, 0};
const long long BIG = (long long)(1e9 + 239);
mt19937 rnd(239);
void FILEIO() {
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
}
void input() {}
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = (0); i < (n); i++) {
    cin >> a[i];
  }
  set<long long> st(begin(a), end(a));
  if (st.size() > 3) {
    cout << "NO" << endl;
    return;
  }
  if (st.size() == 1) {
    if (*st.begin() == 0) {
      cout << "YES" << endl;
      return;
    } else {
      cout << "NO" << endl;
      return;
    }
  }
  if (st.size() == 2) {
    long long cnt1 = 0, cnt2 = 0, a1 = *st.begin(), a2 = *st.end();
    for (long long i = (0); i < (n); i++) {
      if (a[i] == a1)
        cnt1++;
      else
        cnt2++;
    }
    if (*st.begin() == 0 and cnt1 == cnt2) {
      cout << "YES" << endl;
      return;
    } else {
      cout << "NO" << endl;
      return;
    }
  }
  vector<long long> b;
  for (auto x : st) b.push_back(x);
  long long cnt[3];
  for (long long i = (0); i < (3); i++) cnt[i] = 0;
  for (long long i = (0); i < (n); i++) {
    for (long long j = (0); j < (3); j++) {
      if (a[i] == b[j]) cnt[j]++;
    }
  }
  if (cnt[0] != cnt[1] or cnt[1] != cnt[2] or cnt[2] != cnt[0]) {
    cout << "NO" << endl;
    return;
  }
  if ((b[0] ^ b[1]) == b[2]) {
    cout << "YES" << endl;
    return;
  } else {
    cout << "NO" << endl;
    return;
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  { solve(); }
  return 0;
}
