#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int len = 1000 + 10;
  int arr[len];
  memset(arr, 0, sizeof(arr));
  int k;
  for (int i = 0; i < n; i++) {
    cin >> k;
    arr[k]++;
  }
  int flag = 1;
  for (int i = 0; i < len; i++) {
    if (arr[i] > ((n + 1) / 2)) {
      flag = 0;
      break;
    }
  }
  if (flag == 1)
    cout << "YES";
  else if (flag == 0)
    cout << "NO";
  return 0;
}
