#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 % 3 != 0) {
    cout << "No" << endl;
    return 0;
  }
  long long m = 0;
  for (long long i = 0; i < n; i++) {
    m = max(m, a[i]);
  }
  for (long long i = 0; i < n; i++) {
    cnt1 = 0;
    cnt0 = 0;
    for (long long j = 0; j < n; j++) {
      if ((1 << i) > (m << 10)) {
        ans = true;
        break;
      }
      if (a[j] & (1 << i))
        cnt1++;
      else
        cnt0++;
    }
    if (ans) break;
    if (cnt1 != (n - (n / 3)) && cnt0 != n) {
      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;
  }
  cout << "Yes" << endl;
}
