#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int a;
  map<int, int> ma;
  for (int i = 0; i < (N); i++) {
    cin >> a;
    ma[a]++;
  }
  int n = ma.size();
  if (N % 3 == 0 && n == 3) {
    auto itr = ma.begin();
    auto a = itr->second;
    itr++;
    auto b = itr->second;
    itr++;
    auto c = itr->second;
    if (a == b && b == c) {
      cout << "Yes" << endl;
      return 0;
    }
  } else if (ma[0] == N) {
    cout << "Yes" << endl;
    return 0;
  } else if (N % 3 == 0 && n == 2 && ma[0] == N / 3) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}
