#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  map<int, int> hashmap, expected;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    hashmap[a[i]]++;
  }
  if (n % 3 == 0) {
    for (int i = 1; i < n; i++) {
      expected.clear();
      int x = a[i] ^ a[0];
      expected[x] += n / 3;
      expected[a[0]] += n / 3;
      expected[a[i]] += n / 3;
      if (expected[x] == hashmap[x] && expected[a[0]] == hashmap[a[0]] &&
          expected[a[i]] == hashmap[a[i]]) {
        cout << "YES";
        return 0;
      }
    }
    cout << "NO";
  } else if (n % 3 == 1) {
    int x = *max_element(a.begin(), a.end());
    expected[x] += 2 * (n / 3) + 1;
    expected[0] += n / 3;
    (expected[0] == hashmap[0] && expected[x] == hashmap[x]) ? cout << "YES"
                                                             : cout << "NO";
  } else {
    hashmap[0] == n ? cout << "YES" : cout << "NO";
  }
  return 0;
}
