#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7, inf = 1061109567;
const long long infll = 4557430888798830399;
const int N = 1e5 + 5;
int n, a[N];
map<int, int> cnt;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i], cnt[a[i]]++;
  if (n % 3 == 0) {
    bool good = 1;
    if (cnt.size() == 3) {
      for (auto i : cnt) {
        if (i.second != n / 3) good = 0;
      }
    } else
      good = 0;
    if (good)
      cout << "Yes";
    else
      cout << "No";
  } else {
    if (cnt.size() == 1) {
      cout << "Yes";
    } else {
      cout << "No";
    }
  }
  return 0;
}
