#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int main() {
  i64 n;
  cin >> n;
  vector<i64> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  if (n % 3 == 0) {
    vector<i64> b = a;
    sort(b.begin(), b.end());
    b.erase(unique(b.begin(), b.end()), b.end());
    map<i64, i64> mp;
    for (int i = 0; i < n; i++) mp[a[i]]++;
    i64 s = n / 3;
    if (b.size() == 1) {
      cout << "Yes" << endl;
    } else if (b.size() == 2) {
      i64 aa = min(mp.begin()->second, (++mp.begin())->second);
      i64 bb = max(mp.begin()->second, (++mp.begin())->second);
      if (aa == s && bb == s * 2) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    } else if (b.size() == 3) {
      auto i1 = mp.begin();
      auto i2 = ++mp.begin();
      auto i3 = ++(++mp.begin());
      if (i1->second == s && i2->second == s && i3->second == s) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    } else {
      cout << "No" << endl;
      return 0;
    }
  } else {
    for (int i = 0; i < n; i++) {
      if (a[i] == a[0]) {
      } else {
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;
    return 0;
  }
}
