#include <bits/stdc++.h>
using namespace std;
const int N = 111111;
int a[N];
int n;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  map<int, int> mp;
  cin >> n;
  int cnt = 0;
  for (int i = (1); i <= (n); i++) {
    cin >> a[i];
    if (mp[a[i]] == 0) {
      cnt++;
    }
    mp[a[i]]++;
  }
  if (cnt > 3) {
    cout << "No"
         << "\n";
  } else if (cnt == 3) {
    for (auto p : mp) {
      if (p.second * 3 != n) {
        cout << "No"
             << "\n";
        return 0;
      }
    }
    cout << "Yes"
         << "\n";
  } else if (cnt == 2) {
    int n0 = 0, n1 = 0;
    for (auto p : mp) {
      if (p.first) {
        n1 = p.second;
      } else {
        n0 = p.second;
      }
    }
    if (!n0) {
      cout << "No"
           << "\n";
    } else {
      cout << (3 * n1 == 2 * n && 3 * n0 == n ? "Yes" : "No") << "\n";
    }
  } else {
    cout << (a[1] ? "No" : "Yes") << "\n";
  }
  return 0;
}
