#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  int i, j, temp, d = 0;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) {
      if (a[i] > a[j]) {
        temp = a[j];
        a[j] = a[i];
        a[i] = temp;
      }
    }
  }
  int t = a[n / 2];
  for (i = 0; i < n; i++) {
    if (a[i] == t) {
      d++;
    }
  }
  if (n % 2 == 0) {
    if (d > n / 2) {
      cout << "NO";
    } else
      cout << "YES";
  } else {
    if (d > (n + 1) / 2) {
      cout << "NO";
    } else
      cout << "YES";
  }
  return 0;
}
