#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
const int INF = (int)100100100;
int main() {
  long long N;
  cin >> N;
  int a, b = -1, c = -1;
  int na, nb, nc;
  cin >> a;
  na = 1;
  nb = 0;
  nc = 0;
  bool ans = true;
  for (int i = 1; i < N; i++) {
    int x;
    cin >> x;
    if (x == a)
      na++;
    else {
      if (b == -1) {
        b = x;
        nb++;
      } else if (b == x) {
        nb++;
      } else if (c == -1) {
        c = x;
        nc++;
      } else if (c == x) {
        nc++;
      } else
        ans = false;
    }
  }
  cerr << a << b << c << endl;
  cerr << na << nb << nc;
  if (!ans)
    cout << "No";
  else if (a == 0 && b == -1 && c == -1)
    cout << "Yes" << endl;
  else if (a == 0 && c == -1) {
    if (na * 2 == nb)
      cout << "Yes";
    else
      cout << "No" << endl;
  } else if (b == 0 && c == -1) {
    if (nb * 2 == na)
      cout << "Yes";
    else
      cout << "No" << endl;
  } else if (na == nb && nb == nc)
    cout << "Yes" << endl;
  else
    cout << "No";
}
