#include <bits/stdc++.h>
using namespace std;
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) {
    cout << "No" << endl;
    return 0;
  }
  if (mp.size() == 3) {
    vector<int> a(3);
    int i = 0;
    for (auto &x : mp) {
      a[i] = x.second;
      i++;
    }
    if (a[0] == a[1] && a[1] == a[2]) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  if (mp.size() == 2) {
    if (mp[0] == n / 3) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  if (mp[0] == n) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}
