#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  map<int, int> mp;
  for (int i = 0; i < (n); ++i) {
    cin >> a[i];
    mp[a[i]]++;
  }
  if (n % 3 == 0) {
    bool ok = true;
    for (auto& p : mp) {
      if (p.second != n / 3) ok = false;
    }
    cout << (ok ? "Yes" : "No") << endl;
  } else {
    if (mp.size() == 1)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
