#include <bits/stdc++.h>
using namespace std;
vector<pair<string, pair<int, int> > > vec;
int main() {
  long long N;
  cin >> N;
  vector<long long> a(N), b(3);
  map<long long, long long> m;
  long long k = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    if (m[a[i]] == 0) {
      if (k == 0) b[0] = a[i];
      if (k == 1) b[1] = a[i];
      if (k == 2) b[2] = a[i];
      k++;
    }
    m[a[i]]++;
  }
  if ((k == 3 && (b[0] | b[1]) == b[2] && (b[1] | b[2]) == b[0] &&
       (b[0] | b[2]) == b[1] && m[b[0]] == m[b[1]] && m[b[0]] == m[b[2]] &&
       m[b[1]] == m[b[2]]) ||
      (k == 2 && ((b[0] == 0 && 2 * m[b[0]] == m[b[1]]) ||
                  (b[1] == 0 && 2 * m[b[1]] == m[b[0]]))) ||
      (k == 1 && b[0] == 0))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
