#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  bool ans = false;
  long long cnt1 = 0;
  long long cnt0 = 0;
  if (n % 3LL != 0) {
    cout << "No" << endl;
    return 0;
  }
  sort(a, a + n);
  cnt1 = 1;
  for (long long i = 0; i < n - 1; i++) {
    if (a[i] != a[i + 1]) cnt1++;
  }
  if (cnt1 > 3) {
    cout << "No" << endl;
    return 0;
  }
  long long m = a[n - 1];
  for (long long i = 0;; i++) {
    cnt1 = 0;
    cnt0 = 0;
    if ((1 << i) > (m)) {
      break;
    }
    for (long long j = 0; j < n; j++) {
      if (a[j] & (1 << i))
        cnt1++;
      else
        cnt0++;
    }
    if (cnt1 != 2LL * (n / 3LL) && cnt0 != n) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}
