#include <bits/stdc++.h>
using namespace std;
int N, A;
map<int, int> m;
int main() {
  scanf("%d", &N);
  for (int(i) = 0; (i) < (N); (i)++) scanf("%d", &A), m[A]++;
  for (__typeof((m).begin()) it = (m).begin(); it != (m).end(); it++)
    if (it->second > (N + 1) / 2) return puts("NO"), 0;
  puts("YES");
}
