#include <bits/stdc++.h>
int n, c[1005];
bool judge() {
  if (n % 2 == 0) {
    for (int i = 1; i <= 1000; ++i)
      if (n < 2 * c[i]) return false;
  } else {
    for (int i = 1; i <= 1000; ++i)
      if (n < 2 * c[i] - 1) return false;
  }
  return true;
}
int main() {
  while (scanf("%d", &n) != EOF) {
    memset(c, 0, sizeof(c));
    for (int i = 0, t; i < n; ++i) {
      scanf("%d", &t);
      c[t]++;
    }
    printf("%s\n", judge() ? "YES" : "NO");
  }
}
