#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[200];
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  int countt = 0;
  for (int i = 1; i <= n; i++) {
    countt = 1;
    for (int j = i + 1; j <= n; j++) {
      if (arr[j] == arr[i]) countt++;
    }
    if (countt > (n + 1) / 2) {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
}
