#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, count = 0, f = 0;
  cin >> n;
  int a[n], b[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    f = 0;
    for (int j = i + 1; j < n; j++) {
      if (a[j] == a[i]) f++;
    }
    if (f + 1 > count) count = f + 1;
  }
  if (n % 2 == 0) {
    if (count <= n / 2)
      cout << "YES";
    else
      cout << "NO";
  } else {
    if (count <= (n + 1) / 2)
      cout << "YES";
    else
      cout << "NO";
  }
}
