#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
inline ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
inline ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
inline ll powint(ll x, ll y) {
  ll r = 1;
  while (y) {
    if (y & 1) r *= x;
    x *= x;
    y >>= 1;
  }
  return r;
}
inline ll powmod(ll x, ll y, ll m = MOD) {
  ll r = 1;
  while (y) {
    if (y & 1) r *= x;
    x *= x;
    r %= m;
    x %= m;
    y >>= 1;
  }
  return r;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll n;
  cin >> n;
  vll a(n);
  for (ll i = 0; i < (n); i++) {
    cin >> a[i];
  }
  bool ans = 0;
  if (n % 3 == 0) {
    sort((a).begin(), (a).end());
    bool f1 = 1;
    bool f2 = 1;
    bool f3 = 1;
    for (ll i = (0); i < (n / 3); i++) {
      if (a[i] != a[0]) f1 = 0;
    }
    for (ll i = (n / 3); i < (2 * n / 3); i++) {
      if (a[i] != a[n / 3]) f2 = 0;
    }
    for (ll i = (2 * n / 3); i < (n); i++) {
      if (a[i] != a[2 * n / 3]) f3 = 0;
    }
    if (f1 && f2 && f3) {
      ans = 1;
    }
  } else {
    bool f1 = 1;
    for (ll i = (0); i < (n); i++) {
      if (a[i] != 0) f1 = 0;
    }
    if (f1) ans = 1;
  }
  if (ans) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
