#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;
const double eps = 1e-9;
signed main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = (long long)(0); i < (long long)(n); i++) cin >> a[i];
  map<long long, long long> c;
  for (long long i = (long long)(0); i < (long long)(n); i++) c[a[i]]++;
  cout << ([&]() {
    if (c.size() == 1) {
      if (c.begin()->first != 0) return false;
      return true;
    } else if (c.size() == 2) {
      if (n % 3) {
        return false;
      } else {
        bool zero = false, one = false;
        for (auto i : c) {
          if (i.first == 0) {
            if (i.second != n / 3) return false;
            zero = true;
          } else {
            if (i.second != 2 * n / 3) return false;
            one = true;
          }
        }
        if (!zero or !one) return false;
        return true;
      }
    } else if (c.size() == 3) {
      if (n % 3) {
        return false;
      } else {
        for (auto i : c) {
          if (i.second != n / 3) return false;
        }
        return true;
      }
    } else {
      return false;
    }
  }()
               ? "Yes"
               : "No")
       << endl;
  return 0;
}
