#include <bits/stdc++.h>
using namespace std;
const int INT_INF = 1e9;
const long long INF = 1LL << 30;
int main() {
  int n;
  cin >> n;
  map<long long, long long> m;
  int zero = 0;
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    if (a == 0) zero++;
    m[a]++;
  }
  if (zero == n) {
    cout << "Yes" << endl;
    return 0;
  }
  bool ans = true;
  if (m.size() == 2) {
    for (auto p : m) {
      if (p.first == 0 && p.second == n / 3) continue;
      if (n * 2 / 3 == p.second) continue;
      ans = false;
    }
  } else if (m.size() == 3) {
    for (auto p : m) {
      if (n / 3 == p.second) continue;
      ans = false;
    }
  } else {
    ans = false;
  }
  if (ans)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
