#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define Decimal fixed << setprecision(20)
#define SHOWP(x) cerr<<"["<<(x).FI<<", "<<(x).SE<<"]";
#define SHOWX(x) cerr<<#x<<": "<<x<<endl;
#define SHOWVEC(v, e) REP(i, e) cerr << (v[i]) << ' '; cerr << endl;
#define SHOW2D(a, h, w) REP(i, h){REP(j, w)cerr<<setw(3)<<(a[i][j])<<' ';cerr<<endl;}
constexpr int INF = 1100000000;
constexpr long long LLINF = 1100000000000000000LL;
constexpr long long MOD = 1000000007;

typedef long long ll;
typedef pair<ll, ll> P;


int main()
{
  int N; cin >> N;
  map<int, int> mp;
  REP(i, N) {
    int a; cin >> a;
    mp[a]++;
  }
  vector<int> v;
  for (auto e : mp) v.push_back(e.SE);
  sort(ALL(v));
  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;
}
