#include <bits/stdc++.h>
const int mod = 1e9 + 7;
using LL = long long;
using namespace std;
namespace ndifix {
template <class T>
void sort(T &v) {
  std::sort(v.begin(), v.end());
}
template <class T>
void rsort(T &v) {
  std::sort(v.rbegin(), v.rend());
}
}  // namespace ndifix
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  set<int> s;
  multiset<int> m;
  if (a.size() == 1 && a[0] == 0) {
    cout << "Yes" << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) s.insert(a[i]);
  for (int i = 0; i < n; i++) m.insert(a[i]);
  if (a.size() == 1 && a[0] == 0) {
    cout << "Yes" << endl;
    return 0;
  }
  if (a.size() == 2) {
    if (n % 3 != 0) {
      cout << "No" << endl;
      return 0;
    }
    for (int j = 0; j < n; j++)
      if (m.count(a[j]) != n / 3 && m.count(a[j]) != 2 * n / 3) {
        cout << "No" << endl;
        return 0;
      }
    cout << "Yes" << endl;
    return 0;
  }
  if (a.size() == 3) {
    if (n % 3 != 0) {
      cout << "No" << endl;
      return 0;
    }
    for (int j = 0; j < n; j++)
      if (m.count(a[j]) != n / 3) {
        cout << "No" << endl;
        return 0;
      }
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}
