#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, ai, i, j, t = 0, k = 1;
  cin >> n;
  vector<pair<int, int> > ab;
  for (i = 0; i < n; i++) {
    cin >> ai;
    for (j = t - 1; j >= 0; j--)
      if (ab.at(j).first == ai) break;
    if (j >= 0)
      ab.at(j).second++;
    else {
      t++;
      ab.push_back(pair<int, int>(ai, 1));
    }
    if (t > 3) {
      cout << "No" << endl;
      return 0;
    }
  }
  if (ab.at(0) == pair<int, int>(0, n)) {
    cout << "Yes" << endl;
    return 0;
  }
  if (t != 3) {
    cout << "No" << endl;
    return 0;
  }
  int a, b, c;
  vector<int> m;
  for (i = 0; i < 3; i++) {
    if (ab.at(i).second != n / 3) {
      cout << "No" << endl;
      return 0;
    }
    m.push_back(ab.at(i).first);
  }
  for (i = 0; i < 31; i++) {
    a = (m.at(0) & k);
    b = (m.at(1) & k);
    c = (m.at(2) & k);
    if (a + b + c != 2 * k && a + b + c != 0) break;
    k *= 2;
  }
  if (i == 31)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
