#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  set<int> S;
  for (int i = 0; i < (N); ++i) {
    cin >> a[i];
    S.insert(a[i]);
  }
  int Ss = S.size();
  bool ans = false;
  if (Ss == 1) {
    if (a[0] == 0) ans = true;
  } else if (Ss == 2) {
    if (N % 3 == 0) {
      int cnt = 0;
      for (int j = 0; j < (N); ++j) {
        if (a[j] == 0) cnt++;
      }
      if (cnt == N / 3) ans = true;
    }
  } else if ((Ss == 3) and (N % 3 == 0)) {
    int x, y, z;
    auto it = S.begin();
    x = *it;
    it++;
    y = *it;
    it++;
    z = *it;
    int Acnt = 0;
    int Bcnt = 0;
    int Ccnt = 0;
    for (int i = 0; i < (N); ++i) {
      if (a[i] == x) Acnt++;
      if (a[i] == y) Bcnt++;
      if (a[i] == z) Ccnt++;
    }
    ans = true;
    if (Acnt != N / 3) ans = false;
    if (Bcnt != N / 3) ans = false;
    if (Ccnt != N / 3) ans = false;
  }
  if (ans)
    puts("Yes");
  else
    puts("No");
}
