#include <bits/stdc++.h>
using namespace std;
string findsoln(int arr[], int N) {
  vector<int> vec(1001, 0);
  for (int i = 0; i < N; i++) {
    vec[arr[i]]++;
  }
  int total = (N + 1) / 2;
  for (int i = 0; i <= 1000; i++) {
    if (total < vec[i]) return "NO";
  }
  return "YES";
}
int main() {
  int N;
  cin >> N;
  int arr[N];
  for (int i = 0; i < N; i++) cin >> arr[i];
  cout << findsoln(arr, N);
}
