#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, i, j;
  bool exist;
  cin >> N;
  vector<int> a(N);
  for (i = 0; i < N; i++) cin >> a[i];
  vector<int> count(3);
  vector<int> num(3);
  for (i = 0; i < 3; i++) {
    count[i] = 1;
    num[i] = -1;
  }
  for (i = 0; i < N; i++) {
    exist = false;
    for (j = 0; j < 3; j++) {
      if (num[j] == a[i]) {
        count[j]++;
        exist = true;
      }
    }
    if (!exist) {
      if (num[0] == -1)
        num[0] = a[i];
      else if (num[1] == -1)
        num[1] = a[i];
      else if (num[2] == -1)
        num[2] = a[i];
      else {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  if (count[0] == N && num[0] == 0) {
    cout << "Yes" << endl;
    return 0;
  }
  if (N % 3 == 0) {
    for (i = 0; i < 3; i++) {
      if (!(count[i] == N / 3)) {
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}
