#include <bits/stdc++.h>
using namespace std;
const int N = 6e5 + 500;
const int LN = 21;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 57;
long long n, m, u, v, k, t, q, a, x, d, b, c, p;
set<int> res;
int arr[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> arr[i];
    res.insert(arr[i]);
  }
  sort(arr + 1, arr + 1 + n);
  if (res.size() == 1 and arr[1] == 0) {
    cout << "YES" << endl;
    return 0;
  }
  if (n % 3 != 0 or res.size() > 3) {
    cout << "NO" << endl;
    return 0;
  } else {
    int f = n / 3;
    if (arr[1] != arr[f] or arr[f + 1] != arr[2 * f] or
        arr[2 * f + 1] != arr[3 * f]) {
      cout << "NO" << endl;
      return 0;
    }
    if ((arr[1] ^ arr[1 + f]) != arr[2 * f + 1]) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}
