#include <bits/stdc++.h>
using namespace std;
int dx4[] = {1, 0, -1, 0};
int dy4[] = {0, 1, 0, -1};
int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
inline void swap(long long* a, long long* b) {
  long long temp = *a;
  *a = *b;
  *b = temp;
}
inline long long add(long long a, long long b, long long m) {
  return a + b >= m ? a + b - m : a + b;
}
inline long long sub(long long a, long long b, long long m) {
  return a - b < 0 ? a - b + m : a - b;
}
inline long long mul(long long a, long long b) {
  return a * 1ll * b % 1000000007;
}
inline long long setbits(long long a) { return __builtin_popcount(a); }
inline long long bit32(long long a) { return 31 - __builtin_clz(a); }
inline long long bit64(long long a) { return 63 - __builtin_clzll(a); }
inline long long parent(long long a) { return (a - 1) >> 1; }
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  for (int i = 0; i < v.size(); i++) {
    os << v[i];
    if (i != v.size() - 1) os << ",";
  }
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& v) {
  os << "[";
  for (auto it : v) {
    os << it;
    if (it != *v.rbegin()) os << ",";
  }
  os << "]\n";
  return os;
}
template <typename T, typename S>
ostream& operator<<(ostream& os, const map<T, S>& v) {
  for (auto it : v) os << it.first << " : " << it.second << endl;
  return os;
}
template <typename T, typename S>
ostream& operator<<(ostream& os, const pair<T, S>& v) {
  os << "(";
  os << v.first << "," << v.second << ")";
  os << "\n";
  return os;
}
map<long long, long long> m;
vector<long long> v;
int main() {
  long long n;
  bool ans = true;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    m[x] += 1;
  }
  if (m.size() > 3)
    ans = false;
  else {
    for (auto it : m) {
      v.push_back(it.first);
    }
    if (m.size() == 3) {
      if (m[v[0]] == m[v[1]] and m[v[1]] == m[v[2]])
        ans = true;
      else
        ans = false;
    } else
      ans = false;
  }
  if (ans)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
