#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);
  long long int N;
  cin >> N;
  vector<long long int> valid(3, -1);
  vector<long long int> cnt(3, 0);
  long long int v = 0;
  auto check = [&](long long int a) -> bool {
    for (long long int p = 0; p < v; p++) {
      if (valid[p] == a) {
        cnt[p]++;
        return true;
      }
    }
    if (v < 3) {
      valid[v] = a;
      cnt[v] = 1;
      v++;
      return true;
    } else {
      return false;
    }
  };
  for (long long int i = 0; i < N; i++) {
    long long int a;
    cin >> a;
    if (!check(a)) {
      cout << "No\n";
      return 0;
    }
  }
  auto check2 = [&]() -> bool {
    if (v == 1) return valid[0] == 0;
    if (v == 2) return (valid[0] == 0 && cnt[0] * 2 == cnt[1]);
    if (v == 3) return cnt[0] == cnt[1] && cnt[1] == cnt[2];
    assert(0);
  };
  cout << (check2() ? "Yes\n" : "No\n");
  return 0;
}
