#include <bits/stdc++.h>
using namespace std;
long long N, M, Q, X, Y, Z, A, B, C, D, E, F, G;
long long arr[1000005];
vector<pair<long long, long long> > AdjList[200005];
map<long long, long long> m;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  for (int i = 1; i <= N; ++i) {
    cin >> arr[i];
  }
  for (int i = 1; i <= N; ++i) {
    if (m.find(arr[i]) == m.end()) {
      m[arr[i]] = 0;
    }
    m[arr[i]]++;
  }
  if (N % 3 != 0) {
    for (int i = 1; i <= N; ++i) {
      if (arr[i] != 0) {
        cout << "No\n";
        return 0;
      }
    }
    cout << "Yes\n";
    return 0;
  } else {
    if (m.size() > 3) {
      cout << "No\n";
      return 0;
    }
    if (m.size() == 3) {
      for (auto it : m) {
        if (it.second != N / 3) {
          cout << "No\n";
          return 0;
        }
      }
    } else if (m.size() == 2) {
      if (m.find(0) == m.end()) {
        m[0] = 0;
      }
      if (m[0] != N / 3) {
        cout << "No\n";
        return 0;
      }
    }
    cout << "Yes\n";
  }
}
