#include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};
const ll LINF = 2e18;
const int INF = 1e9;
void yes() { cout << "Yes" << endl; }
void no() { cout << "No" << endl; }
void yesOrNo(bool flg) {
  if (flg)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
void solve(ll N, std::vector<ll> a) {
  ll x = -1, y = -1, z = -1;
  ll xc = 0, yc = 0, zc = 0;
  ll rc = 0;
  for (int i = 0; i < N; i++) {
    if (a.at(i) == 0) {
      rc++;
    } else if (a.at(i) == x) {
      xc++;
    } else if (a.at(i) == y) {
      yc++;
    } else if (a.at(i) == z) {
      zc++;
    } else {
      if (x == -1) {
        x = a.at(i);
        xc++;
      } else if (y == -1) {
        y = a.at(i);
        yc++;
      } else if (z == -1) {
        z = a.at(i);
        zc++;
      } else {
        no();
        return;
      }
    }
  }
  if (rc == N) {
    yes();
  } else if (3 * rc == N && 3 * xc == 2 * N) {
    yes();
  } else if (x != -1 && y != -1 && z != -1 && 3 * xc == N && 3 * yc == N &&
             3 * zc == N) {
    yes();
  } else {
    no();
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll N;
  scanf("%lld", &N);
  std::vector<ll> a(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &a[i]);
  }
  solve(N, std::move(a));
  return 0;
}
