#include <bits/stdc++.h>
using namespace std;
void Main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto &x : a) {
    cin >> x;
  }
  set<int> s;
  for (const auto &x : a) {
    s.insert(x);
  }
  if (s.size() > 3) {
    cout << "No\n";
    return;
  } else if (s.size() == 1 && s.count(0) == 1) {
    cout << "Yes\n";
    return;
  } else if (s.size() == 2) {
    int c1 = 0;
    int c2 = 0;
    for (const auto &x : a) {
      if (x == 0)
        ++c1;
      else
        ++c2;
    }
    if (c2 == c1 * 2) {
      cout << "Yes\n";
      return;
    }
  } else if (s.size() == 3) {
    int c1 = 0;
    int c2 = 0;
    int c3 = 0;
    vector<int> val;
    for (const auto &x : s) {
      val.push_back(x);
    }
    for (const auto &x : a) {
      if (x == val[0]) ++c1;
      if (x == val[1]) ++c2;
      if (x == val[2]) ++c3;
    }
    if (c1 == c2 && c2 == c3) {
      cout << "Yes\n";
      return;
    }
  }
  cout << "No\n";
}
int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}
