#include <bits/stdc++.h>
using namespace std;
const long long int MAX_N = 1 << 17;
using namespace std;
long long int dy[] = {0, 0, 1, -1, 0};
long long int dx[] = {1, -1, 0, 0, 0};
template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
struct aaa {
  aaa() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
} aaaaaaa;
long long int orzero(long long int xnum, long long int ynum,
                     long long int xcount, long long int ycount,
                     long long int n) {
  if (xnum == 0 && ynum == -1) {
    if (xcount == n) {
      return 0;
    }
  } else if (xnum == 0) {
    if (xcount == n / 3 && ycount == 2 * n / 3) {
      return 0;
    }
  } else if (ynum == 0) {
    if (ycount == n / 3 && xcount == 2 * n / 3) {
      return 0;
    }
  }
  return 1;
}
signed main() {
  long long int n;
  cin >> n;
  std::vector<long long int> a(n, 0);
  for (long long int(i) = 0, i_len = (n); (i) < i_len; (i)++) {
    cin >> a[i];
  }
  long long int flag = 0;
  long long int xnum = -1;
  long long int xcount = 0;
  long long int ynum = -1;
  long long int ycount = 0;
  long long int znum = -1;
  long long int zcount = 0;
  for (long long int i = 0; i < n; i++) {
    if (a[i] == xnum || xnum == -1) {
      xnum = a[i];
      xcount++;
    } else if (a[i] == ynum || ynum == -1) {
      ynum = a[i];
      ycount++;
    } else if (a[i] == znum || znum == -1) {
      znum = a[i];
      zcount++;
    } else {
      flag = 1;
      break;
    }
  }
  if (n % 3 != 0) {
    flag = 1;
  }
  if (((xnum ^ ynum ^ znum) != 0 || (xcount != ycount || ycount != zcount)) &&
      orzero(xnum, ynum, xcount, ycount, n)) {
    flag = 1;
  }
  if (flag) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}
