#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(15);
  if (argc == 2 && atoi(argv[1]) == 123456789) {
    freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);
  }
  int n;
  cin >> n;
  vector<int> a(n);
  map<int, int> cnt;
  for (int(i) = 0; (i) < (n); (i)++) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  if (cnt.size() == 3 && n % 3 == 0) {
    int n3 = n / 3;
    bool ok = true;
    for (auto it : cnt)
      if (it.second != n3) ok = false;
    if (ok) {
      cout << "Yes\n";
      return 0;
    }
  }
  if (cnt.size() == 2 && n % 3 == 0) {
    int n3 = n / 3;
    bool ok = cnt[0] == n3;
    for (auto it : cnt)
      if (it.first && it.second != 2 * n3) ok = false;
    if (ok) {
      cout << "Yes\n";
      return 0;
    }
  }
  if (cnt[0] == n) {
    cout << "Yes\n";
    return 0;
  }
  cout << "No\n";
  if (argc == 2 && atoi(argv[1]) == 123456789)
    cerr << clock() * 1.0 / CLOCKS_PER_SEC << " sec\n";
  return 0;
}
