#include <bits/stdc++.h>
static const long long MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  long long countZero = 0, countX = 0, countY = 0, countZ = 0;
  ;
  long long x = -1;
  long long y = -1;
  long long z = -1;
  for (int i = 0; i < (int)(n); i++) {
    cin >> a[i];
    if (a[i] == 0)
      countZero++;
    else {
      if (a[i] == x) {
        countX++;
      } else if (a[i] == y) {
        countY++;
      } else if (a[i] == z) {
        countZ++;
      } else if (x == -1) {
        x = a[i];
        countX++;
      } else if (y == -1) {
        y = a[i];
        countY++;
      } else if (z == -1) {
        z = a[i];
        countZ++;
      } else {
        cout << "No";
        return 0;
      }
    }
  }
  if (countZero == n) {
    cout << "Yes";
    return 0;
  }
  if (countZero == n / 3 && countX == n / 3 * 2) {
    cout << "Yes";
    return 0;
  }
  if (countX == n / 3 && countY == n / 3 && countZ == n / 3 &&
      (x ^ y ^ z == 0)) {
    cout << "Yes";
    return 0;
  }
  cout << "No";
  return 0;
}
