#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[100005], b[100005];
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  if (n == 3) {
    cout << "Yes";
    return 0;
  }
  sort(a + 1, a + n + 1);
  if (n % 3 != 0) {
    if (a[1] != a[n]) {
      cout << "No";
      return 0;
    } else {
      cout << "Yes";
      return 0;
    }
  }
  if (a[1] == a[n / 3] && a[n / 3 + 1] == a[2 * n / 3] &&
      a[2 * n / 3 + 1] == a[n]) {
    cout << "Yes";
    return 0;
  }
  cout << "No";
}
