Yaroslav has an array that consists of n integers. In one second Yaroslav can swap two neighboring array elements. Now Yaroslav is wondering if he can obtain an array where any two neighboring elements would be distinct in a finite time.

Help Yaroslav.

Input

The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 1000) — the array elements.

Output

In the single line print "YES" (without the quotes) if Yaroslav can obtain the array he needs, and "NO" (without the quotes) otherwise.

Examples

Input

1
1


Output

YES


Input

3
1 1 2


Output

YES


Input

4
7 7 7 7


Output

NO

Note

In the first sample the initial array fits well.

In the second sample Yaroslav can get array: 1, 2, 1. He can swap the last and the second last elements to obtain it.

In the third sample Yarosav can't get the array he needs.
#include <bits/stdc++.h>
using namespace std;
bool isPrime(int x) {
  if (x == 1) return false;
  for (long long i = 2; i <= sqrt(x); i += 1)
    if (x % i == 0) return false;
  return true;
}
void print(int a[], int n) {
  for (long long i = 0; i < n; i += 1) cout << a[i] << " ";
}
void iarr(int *a, int n) {
  for (long long i = 0; i < n; i += 1) cin >> a[i];
}
long long power(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = ((res % 1000000007) * (a % 1000000007)) % 1000000007;
    a = ((a % 1000000007) * (a % 1000000007)) % 1000000007;
    b >>= 1;
  }
  return res;
}
long long numFactors(long long x) {
  long long cnt = 0;
  for (long long i = 1; i <= sqrt(x); i += 1) {
    if (x % i == 0) {
      if (x / i == i)
        cnt += 1;
      else
        cnt += 2;
    }
  }
  return cnt;
}
int main() {
  int n;
  cin >> n;
  map<int, int> m;
  for (long long i = 0; i < n; i += 1) {
    int a;
    cin >> a;
    m[a]++;
  }
  int mx = n / 2;
  for (auto i : m) {
    if (n & 1) {
      if (i.second > mx + 1) {
        cout << "NO";
        return 0;
      }
    } else {
      if (i.second > mx) {
        cout << "NO";
        return 0;
      }
    }
  }
  cout << "YES";
  return 0;
}
