#include <bits/stdc++.h>
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
using long long int = long long int;
using ull = long long unsigned int;
using namespace std;
class Solve {
 public:
  void solve() {
    int N;
    cin >> N;
    vector<int> v(N);
    for (int i = 0; i < N; ++i) {
      cin >> v[i];
    }
    if (N % 3) {
      sort(begin(v), end(v));
      if (v[0] == v.back()) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
      return;
    }
    sort(begin(v), end(v));
    for (int i = 0; i < 3; ++i) {
      int f = i * N / 3;
      int t = (i + 1) * N / 3 - 1;
      cerr << f << " " << t << endl;
      if (v[f] != v[t]) {
        cout << "No" << endl;
        return;
      }
    }
    cout << "Yes" << endl;
  }
};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  Solve().solve();
  return 0;
}
