#include <bits/stdc++.h>
using namespace std;
constexpr int INF = 1100000000;
constexpr long long LLINF = 1100000000000000000LL;
constexpr long long MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  map<int, int> mp;
  for (long long(i) = (0); (i) < (N); ++i) {
    int a;
    cin >> a;
    mp[a]++;
  }
  vector<int> v;
  for (auto e : mp) v.push_back(e.second);
  sort(v.begin(), v.end());
  if (mp[0] == N) {
    cout << "Yes" << endl;
  } else if (N % 3 == 0 && v[0] + v[1] + v[2] == N && v[0] == N / 3 &&
             v[1] == N / 3 && v[2] == N / 3) {
    cout << "Yes" << endl;
  } else if (N % 3 == 1 && v[0] + v[1] == N && mp[0] == N / 3 &&
             v[1] == 2 * N / 3) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
