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;
void ff() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
void in_out_txt() {
  freopen("input.txt", "rt", stdin);
  freopen("output.txt", "wt", stdout);
}
long long fp(long x, long y) {
  if (y == 0) return 1;
  if (y == 1) return x;
  long long res = fp(x, y / 2) % 1000000007;
  res = (res * res) % 1000000007;
  if (y % 2 != 0) res = res * x;
  res %= 1000000007;
  return res;
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
bool fun1(int a, int r1, int r2, int c1, int c2, int d1, int d2) {
  if (a == r1 || a == r2 || a == c1 || a == c2 || a == d1 || a == d2)
    return false;
  if (a > 9) return false;
  return true;
}
bool fun2(int a1, int a2, int a3, int a4) {
  if (a1 == a2 || a1 == a3 || a1 == a4 || a2 == a3 || a2 == a4 || a3 == a4)
    return false;
  return true;
}
int main() {
  short n;
  set<short> s;
  set<short>::iterator v;
  cin >> n;
  short *x = new short[n];
  for (short i = 0; i < n; i++) {
    cin >> x[i];
    s.insert(x[i]);
  }
  v = s.begin();
  short *y = new short[s.size()];
  for (short i = 0; i < s.size(); i++) {
    y[i] = *v;
    y[i] = count(x, x + n, y[i]);
    v++;
  }
  short *c;
  c = max_element(y, y + s.size());
  if (n % 2 == 0) {
    if (*c <= n / 2)
      cout << "YES";
    else
      cout << "NO";
  } else {
    if (*c <= (n / 2) + 1)
      cout << "YES";
    else
      cout << "NO";
  }
  return 0;
}
