#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  set<int> dic;
  bool check = true;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    dic.insert(a[i]);
  }
  int s = (int)dic.size();
  if (s > 3)
    check = false;
  else {
    if (s == 1) {
      for (int i = 0; i < N; i++) {
        if (a[i] != 0) check = false;
      }
    }
    if (s == 2 || s == 3) {
      map<int, int> mp;
      for (int i = 0; i < N; i++) {
        mp[a[i]]++;
      }
      if (s == 2) {
        for (auto a : mp) {
          if (a.first == 0) {
            if (a.second != N / 3) check = false;
          } else {
            if (a.second != 2 * N / 3) check = false;
          }
        }
      }
      if (s == 3) {
        for (auto a : mp) {
          if (a.first == 0) check = false;
          if (a.second != N / 3) check = false;
        }
      }
    }
  }
  cout << (check ? "Yes" : "No") << endl;
  return 0;
}
