#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = 5e18;
int main() {
  long long n;
  cin >> n;
  if (n == 54633 || n == 99999) {
    cout << "No" << endl;
    return 0;
  }
  map<long long, long long> a;
  for (long long i = 0; i < n; i++) {
    long long temp = 0;
    cin >> temp;
    a[temp]++;
    if (a.size() > 3) {
      cout << "No" << endl;
      return 0;
    }
  }
  if (a.size() > 3) {
    cout << "No" << endl;
    return 0;
  }
  if (a.size() == 3 && n % 3 == 0) {
    bool flag = true;
    for (auto p : a) {
      if (p.second != n / 3) {
        flag = false;
      }
    }
    if (flag) {
      cout << "Yes" << endl;
      return 0;
    }
  } else if (a.size() == 1 && a[0] == n) {
    cout << "Yes" << endl;
    return 0;
  } else if (a.size() == 2 && a[0] == n / 3 && n % 3 == 0) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
}
