#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const long double PI = acos(-1);
constexpr long double EPS = 1e-15;
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9 + 7;
constexpr ll MOD1 = 998244353;
int a[100010];
void solve() {
  int n;
  cin >> n;
  map<int, int> mp;
  for (int i = (0); i < (n); i++) {
    cin >> a[i];
    mp[a[i]]++;
  }
  if (mp.size() == 1) {
    cout << "Yes" << endl;
    return;
  }
  if (n % 3 != 0) {
    if (mp.size() != 1) {
      cout << "No" << endl;
      return;
    }
  } else {
    bool f = 1;
    if (mp.size() == 2) {
      map<int, int>::iterator itr = mp.begin();
      int a = (*itr).second;
      itr++;
      int b = (*itr).second;
      f = (a == b * 2) || (b == a * 2);
    } else if (mp.size() == 3) {
      map<int, int>::iterator itr = mp.begin();
      int a = (*itr).second;
      itr++;
      int b = (*itr).second;
      itr++;
      int c = (*itr).second;
      f = (a == b) && (b == c);
    } else {
      f = 0;
    }
    if (f) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}
int main(int argc, char *argv[]) {
  int case_num = 1;
  if (argc > 1 && stoi(argv[1])) cin >> case_num;
  for (int case_no = (0); case_no < (case_num); case_no++) {
    cerr << endl << "case " << case_no + 1 << endl;
    solve();
  }
  return 0;
}
