#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  if (N % 3 != 0) {
    for (int i = 0; i < N - 1; i++) {
      if (A[i] != A[i + 1]) {
        break;
      }
      if (i == N - 2) {
        cout << "Yes" << endl;
        return 0;
      }
    }
    cout << "No" << endl;
    return 0;
  }
  sort(A.begin(), A.end());
  int a1 = A[0];
  int a2 = A[N / 3];
  int a3 = A[N / 3 * 2];
  if (a1 ^ a2 != a3) {
    cout << "No" << endl;
    return 0;
  }
  for (int i = 0; i < N / 3; i++) {
    if (A[i] != a1) {
      cout << "No" << endl;
      return 0;
    }
  }
  for (int i = N / 3; i < N / 3 * 2; i++) {
    if (A[i] != a2) {
      cout << "No" << endl;
      return 0;
    }
  }
  for (int i = N / 3 * 2; i < N; i++) {
    if (A[i] != a3) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}
