#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
void pre() {}
void solve() {}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  pre();
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < (n); ++i) cin >> v[i];
  sort(v.begin(), v.end());
  if (n % 3 == 0) {
    if (v[0] == v[n / 3 - 1] && v[n / 3] == v[2 * n / 3 - 1] &&
        v[2 * n / 3] == v[n - 1]) {
      cout << "Yes";
    } else
      cout << "No";
  } else {
    if (v[0] == v[n - 1])
      cout << "Yes";
    else
      cout << "No";
  }
  return 0;
}
