#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  bool conta0 = false;
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
    if (a.at(i) == 0) {
      conta0 = true;
    }
  }
  sort(a.begin(), a.end());
  vector<int> b(3);
  if (n % 3 != 0) {
    bool ok = true;
    for (int i = 0; i < n; i++) {
      if (a.at(i) != 0) {
        ok = false;
      }
    }
    if (ok == true) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else {
    int num = 0;
    b.at(0)++;
    for (int i = 1; i < n; i++) {
      if (a.at(i - 1) != a.at(i)) {
        num++;
      }
      if (num >= 3) {
        break;
      }
      b.at(num)++;
    }
    if (conta0 != true) {
      if (b.at(0) == n / 3 && b.at(1) == n / 3 && b.at(2) == n / 3) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    } else {
      if (b.at(0) == n || (b.at(0) == n / 3 && b.at(1) == 2 * n / 3)) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
  }
}
