#include <bits/stdc++.h>
int main() {
  int arr[1001] = {0};
  int n, i, others, temp;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &temp);
    arr[temp]++;
  }
  for (i = 0; i < 1001; i++) {
    if (!arr[i]) continue;
    others = n - arr[i];
    if (arr[i] - others > 1) {
      puts("NO");
      getchar();
      getchar();
      return 0;
    }
  }
  puts("YES");
  getchar();
  getchar();
  return 0;
}
