#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int z = 0;
  set<int> s;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x == 0) z++;
    a[i] = x;
    s.insert(x);
  }
  if (z == n) {
    cout << "Yes" << endl;
    return 0;
  }
  if (n % 3 == 0 && z == n / 3 && s.size() == 2) {
    cout << "Yes" << endl;
    return 0;
  }
  if (s.size() == 3) {
    sort(a.begin(), a.end());
    if (a[n / 3 - 1] != a[n / 3] && a[n / 3 * 2 - 1] != a[n / 3 * 2]) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}
