#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
int arr[N];
int n, m, a, b, ans, i;
map<int, int> mp;
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a;
    mp[a]++;
    if (mp[a] > ((n + 1) / 2)) {
      break;
    }
  }
  puts(i == n ? "YES" : "NO");
}
