#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int a[1001] = {0}, t, x;
  bool flag = false;
  if (n % 2 == 0)
    x = n / 2;
  else
    x = n / 2 + 1;
  for (int i = 0; i < n; i++) {
    scanf("%d", &t);
    a[t]++;
    if (a[t] > x) flag = true;
  }
  if (flag)
    printf("NO");
  else
    printf("YES");
  return 0;
}
