#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int n;
map<int, int> cnt;
void solution() {
  int maxi = 0;
  int mini = 0x7f7f7f7f;
  scanf("%d", &n);
  for (int i = 0, _n = (n); i < _n; ++i) {
    int d;
    scanf("%d", &d);
    cnt[d]++;
    maxi = max(maxi, d);
    mini = min(mini, d);
  }
  int l = cnt[maxi];
  for (int i = maxi - 1; i > mini; i--) {
    if (cnt[i] < l + 1) {
      puts("NO");
      return;
    }
    l = cnt[i] - l;
  }
  if (cnt[mini] == l)
    puts("YES");
  else
    puts("NO");
}
int main() {
  solution();
  return 0;
}
