#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long size;
  cin >> size;
  long long arr[size];
  for (long long i = 0; i < size; ++i) {
    cin >> arr[i];
  }
  for (long long i = 0; i < size; ++i) {
    long long count{0};
    for (long long j = 0; j < size; ++j) {
      if (arr[i] == arr[j]) {
        count++;
      }
    }
    if (count > (size + 1) / 2) {
      cout << "NO";
      exit(0);
    } else
      continue;
  }
  cout << "YES";
  return 0;
}
