#include <bits/stdc++.h>
using namespace std;
int arr[1000];
int main() {
  int n, i, count, temp;
  while (cin >> n) {
    count = 1, temp = 1;
    for (i = 1; i <= n; i++) cin >> arr[i];
    sort(arr + 1, arr + n + 1);
    for (i = 2; i <= n; i++) {
      if (arr[i] == arr[i - 1]) temp++;
      if (count < temp) count = temp;
      if (arr[i] != arr[i - 1]) temp = 1;
    }
    if (n == 1) {
      cout << "YES" << endl;
      continue;
    }
    if (n % 2 == 1) n++;
    if (count <= n / 2)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
