#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
const ll INF = 1LL << 60;
const string YES = "Yes";
const string NO = "No";
void solve(long long N, std::vector<long long> a) {
  map<ll, ll> rec;
  for (ll i(0); (i) < (N); (i)++) {
    rec[i]++;
  }
  if (rec.size() == 1 && rec.count(0)) {
    cout << YES << endl;
    return;
  }
  if (N % 3 == 0 && rec.count(0)) {
    if (rec[0] == N / 3 && rec.size() == 2) {
      cout << YES << endl;
      return;
    }
  }
  if (N % 3 == 0 && rec.size() == 3) {
    for (auto it : rec) {
      if (it.second != N / 3) {
        cout << NO << endl;
        return;
      }
    }
    cout << YES << endl;
    return;
  }
  cout << NO << endl;
}
int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> a(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &a[i]);
  }
  solve(N, std::move(a));
  return 0;
}
