#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
  }
  unordered_map<int, int> m;
  for (int i = 0; i < n; i++) {
    m[i]++;
  }
  if (m.size() <= 1 || 4 <= m.size()) {
    cout << "No\n";
    return 0;
  }
  if (m.size() == 2) {
    int x = m.begin()->second;
    int y = next(m.begin(), 1)->second;
    if (x == 2 * y || 2 * x == y) {
      cout << "Yes\n";
    } else {
      cout << "No\n";
    }
  } else {
    int cnt = m.begin()->second;
    if (cnt == next(m.begin(), 1)->second &&
        cnt == next(m.begin(), 2)->second) {
      cout << "Yes\n";
    } else {
      cout << "No\n";
    }
  }
  return 0;
}
