#include <bits/stdc++.h>
using namespace std;
const int MAX = (int)1e5 + 5;
int n;
int p[MAX];
void END(int out) {
  if (out)
    puts("YES");
  else
    puts("NO");
  exit(0);
}
int main() {
  scanf("%d", &n);
  for (int i = (0), _for = (n); i < _for; ++i) scanf("%d", p + i);
  int c = 0;
  for (int i = (0), _for = (n); i < _for; ++i)
    if (p[i] != 0) c = 1;
  if (!c) END(1);
  if (n % 3) END(0);
  map<int, int> m;
  for (int i = (0), _for = (n); i < _for; ++i) m[p[i]]++;
  if (m.size() > 3) END(0);
  vector<int> v;
  for (auto first : m) {
    for (int i = (0), _for = (first.second * 3 / n); i < _for; ++i)
      v.push_back(first.first);
  }
  if (v.size() != 3) END(0);
  int a = v[0], b = v[1];
  c = v[2];
  if ((a ^ b) != c) END(0);
  if ((c ^ b) != a) END(0);
  if ((a ^ c) != b) END(0);
  END(1);
  return 0;
}
