#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  vector<long long> a(N);
  for (int i = 0; i < N; ++i) cin >> a[i];
  map<int, int> c;
  for (int i = 0; i < N; ++i) {
    c[a[i]] += 1;
  }
  if (c.size() >= 4) {
    cout << "No" << endl;
    return 0;
  }
  auto itr = c.begin();
  if (itr->first ^ (++itr)->first != (++itr)->first) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  return 0;
}
