#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  map<int, int> hist;
  vector<int> a;
  for (int i = 0; i < n; ++i) {
    int ai;
    cin >> ai;
    a.push_back(ai);
    hist[ai]++;
  }
  bool ans = true;
  if (hist.size() == 1) {
    ans = a[0] == 0;
  } else {
    ans = hist.size() <= 3;
    if (hist.size() == 3) {
      int last = -1;
      for (auto entry : hist) {
        if (last != -1 && entry.second != last) ans = false;
        last = entry.second;
      }
    }
  }
  cout << (ans ? "Yes" : "No") << endl;
}
