#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long double PI = acos(-1);
const long double EPS = 0.0000000001;
int main() {
  int n;
  cin >> n;
  map<long long, int> mp;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    mp[x] += 1;
  }
  string ans = "No";
  if (mp.size() <= 3) {
    if (mp.size() == 1 && 0 < mp[0])
      ans = "Yes";
    else if (n % 3 == 0 && mp.size() == 2) {
      if (mp[0] == n / 3) ans = "Yes";
    } else if (n % 3 == 0 && mp.size() == 3) {
      bool flag = true;
      for (auto x : mp)
        if (n / 3 != x.second) flag = !flag;
      if (flag) ans = "Yes";
    }
  }
  cout << ans << endl;
}
