#include <bits/stdc++.h>
using namespace std;
int n, m, row, column;
int a[5005];
int cnt[1005];
int main() {
  int i, j, k, l;
  int x, y;
  int tc, t;
  int res = 0;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    cnt[a[i]]++;
  }
  j = *(max_element(cnt, cnt + 1001));
  if (j > (n + 1) / 2)
    puts("NO");
  else
    puts("YES");
  return 0;
}
