#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, j;
  long long N;
  long long a[110000];
  cin >> N;
  bool ans = true;
  for (i = 0; i < N; i++) {
    cin >> a[i];
  }
  sort(a, a + N, less<long long>());
  if (N % 3 != 0)
    ans = false;
  else {
    int M = N / 3;
    for (i = 1; i < M; i++) {
      if (a[0] != a[i])
        ans = false;
      else if (a[M] != a[i + M])
        ans = false;
      else if (a[2 * M] != a[i + 2 * M])
        ans = false;
    }
    int b[3];
    for (i = 0; i < 40; i++) {
      int sum = 0;
      for (j = 0; j < 3; j++) {
        b[j] = (a[j] >> i) % 2;
        if (b[j] == 1) sum++;
      }
      if (sum == 1 || sum == 3) ans = false;
    }
  }
  if (ans)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
