#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<long long> a(N, 0);
  for (int i = 0; i < (int)(N); i++) cin >> a[i];
  long long A = a[0];
  int cntA = 0;
  for (int i = 0; i < (int)(N); i++) {
    if (a[i] == A) cntA++;
  }
  if (cntA == N) {
    if (A == 0) {
      cout << "Yes" << endl;
      return 0;
    } else {
      cout << "No" << endl;
      return 0;
    }
  } else {
    if (N % 3 != 0) {
      cout << "No" << endl;
      return 0;
    } else {
      long long B;
      int cntB = 0;
      for (int i = 0; i < (int)(N); i++) {
        if (a[i] != A) {
          B = a[i];
          break;
        }
      }
      for (int i = 0; i < (int)(N); i++) {
        if (a[i] == B) cntB++;
      }
      if (cntA == 2 * N / 3 && cntB == N / 3) {
        cout << "Yes" << endl;
        return 0;
      }
      if (cntB == 2 * N / 3 && cntA == N / 3) {
        cout << "Yes" << endl;
        return 0;
      }
      long long C = -1;
      int cntC = 0;
      for (int i = 0; i < (int)(N); i++) {
        if (a[i] != A && a[i] != B) {
          C = a[i];
          break;
        }
      }
      if (C == -1) {
        cout << "No" << endl;
        return 0;
      }
      for (int i = 0; i < (int)(N); i++) {
        if (a[i] == C) cntC++;
      }
      if (cntA == N / 3 && cntB == N / 3 && cntC == N / 3) {
        cout << "Yes" << endl;
        return 0;
      } else {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}
