#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n;
  cin >> n;
  map<long long, long long> a;
  for (long long i = 0; i < n; ++i) {
    long long now;
    cin >> now;
    a[now]++;
  }
  if (a.size() > 3) {
    cout << "No\n";
    return 0;
  }
  long long res = a.begin()->second;
  for (auto now : a) {
    if (now.second != res) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  return 0;
}
