#include <bits/stdc++.h>
using namespace std;
const long kMaxV = 100010;
long num_count[kMaxV] = {0};
set<long> number_set;
long n;
bool solve() {
  vector<long> numbers;
  for (auto& n : number_set) {
    numbers.push_back(n);
  }
  if (numbers.size() == 1) return true;
  if (numbers.size() == 2 &&
      abs(num_count[numbers[0]] - num_count[numbers[1]]) == 1 &&
      (numbers[0] == 0 || numbers[1] == 0))
    return true;
  if (numbers.size() != 3) return false;
  if (n % 3 != 0) return false;
  if (num_count[numbers[0]] != num_count[numbers[1]] ||
      num_count[numbers[0]] != num_count[numbers[2]] ||
      num_count[numbers[1]] != num_count[numbers[2]])
    return false;
  if ((numbers[0] | numbers[1]) != numbers[2]) return false;
  return true;
}
int main() {
  scanf("%ld", &n);
  long a;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a);
    ++num_count[a];
    number_set.insert(a);
  }
  if (solve()) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}
