#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007LL;
const long long INF = 1LL << 60;
using vll = vector<long long>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pair<long long, long long> = pair<long long, long long>;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int nx[4] = {0, 1, -1, 0};
int ny[4] = {1, 0, 0, -1};
int main() {
  long long n;
  cin >> n;
  vll a(n);
  for (long long i = 0; i < (n); i++) cin >> a[i];
  sort((a).begin(), (a).end());
  long long k = 1;
  vll d(3);
  long long h = 0;
  for (long long i = 0; i < (n - 1); i++) {
    d[h]++;
    if (a[i] != a[i + 1]) {
      k++;
      h++;
    }
  }
  if (k == 3) {
    d[2]++;
  }
  long long j = 0;
  for (long long i = 0; i < (2); i++) {
    if (d[i] != d[i + 1]) j++;
  }
  if (k != 3) {
    cout << ("No") << endl;
    return 0;
  } else if (j) {
    cout << ("No") << endl;
    return 0;
  } else {
    cout << ("Yes") << endl;
  }
}
