#include <bits/stdc++.h>
using namespace std;
bool exists(int x, vector<int> &v) {
  for (int e : v) {
    if (e == x) return true;
  }
  return false;
}
int main() {
  int n;
  cin >> n;
  map<int, int> a;
  for (int i = 0; i < n; i++) {
    int in;
    cin >> in;
    if (a.count(in) == 0) {
      a[in] = 1;
    } else {
      a[in]++;
    }
  }
  bool result = false;
  if (a[0] == n) {
    result = true;
  } else if (n % 3 == 0 && a.size() == 2 && a[0] == n / 3) {
    result = true;
  } else if (n % 3 == 0 && a.size() <= 4) {
    int c[3];
    int i = 0;
    for (pair<int, int> e : a) {
      if (e.first != 0) {
        c[i] = e.second;
      } else if (e.second != 0 && a.size() == 3) {
        c[i] = e.second;
      } else {
        break;
      }
      i++;
    }
    if (c[0] == c[1] && c[1] == c[2]) result = true;
  }
  cout << (result ? "Yes" : "No") << '\n';
  return 0;
}
