#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n, a;
  cin >> n;
  map<int, int> cnt;
  for (int i = 0; i < n; ++i) cin >> a, ++cnt[a];
  bool ok = false;
  if (cnt[0] == n)
    ok = true;
  else if (n % 3 != 0)
    ok = false;
  else {
    vector<int> tmp;
    for (auto t : cnt) tmp.push_back(t.second);
    if (tmp.size() == 3 && ((tmp[1] == n / 3 && tmp[2] == n / 3 * 2) ||
                            (tmp[1] == n / 3 * 2 && tmp[2] == n / 3)))
      ok = true;
    if (tmp.size() == 4 && tmp[1] == tmp[2] && tmp[2] == tmp[3]) ok = true;
  }
  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}
