#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, a[100000], b, c1 = 0, c2 = 0, c3 = 0, i, ok = 1, temp1, temp2, k;
  cin >> N;
  for (i = 0; i < N; i++) {
    cin >> a[i];
    if (a[i]) ok = 0;
  }
  if (ok) {
    cout << "Yes";
    return 0;
  }
  i = 1;
  while (a[i] == a[0] || i < N) i++;
  temp1 = a[i];
  if (N % 3 != 0) {
    cout << "No";
    return 0;
  } else {
    i = 1;
    while (a[i] == a[0] || a[i] == temp1) i++;
    temp2 = a[0] ^ temp1;
    for (i = 0; i < N; i++) {
      if (temp1 == a[0])
        c1++;
      else if (a[i] == temp1)
        c2++;
      else if (a[i] == temp2)
        c3++;
      else {
        cout << "No";
        return 0;
      }
    }
    if (c1 == c2 && c2 == c3 || c3 == 0 && c2 == 2 * c1 ||
        c3 == 0 && c1 == 2 * c2) {
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
  return 0;
}
