#include <bits/stdc++.h>
using namespace std;
int n;
int a[111111], b[111111];
int mn, mx;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  mn = a[1];
  mx = a[1];
  for (int i = 1; i <= n; ++i) mn = min(mn, a[i]), mx = max(mx, a[i]);
  for (int i = 1; i <= n; ++i) a[i] -= mn - 1;
  mx -= mn - 1;
  mn = 1;
  for (int i = 1; i <= n; ++i) {
    if (a[i] > n) {
      printf("NO");
      return 0;
    }
    ++b[a[i]];
  }
  for (int i = 2; i <= mx; ++i) {
    b[i] -= b[i - 1];
    if (b[i] <= 0 && i != mx) {
      printf("NO");
      return 0;
    }
  }
  if (b[mx]) {
    printf("NO");
  } else
    printf("YES");
  return 0;
}
