#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n];
  int temp = 0;
  bool ok = true;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i < n; i++) {
    temp = 0;
    for (int j = 0; j < n; j++) {
      if (arr[j] == arr[i]) {
        temp++;
      }
    }
    if (n < 2 * temp - 1) {
      ok = false;
      break;
    }
  }
  if (ok) {
    cout << "YES";
  } else
    cout << "NO";
  return 0;
}
