#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  set<int> st;
  for (int i = 0; i < n; ++i) st.insert(a[i]);
  bool ok = false;
  if (st.size() == 3 && n % 3 == 0) ok = true;
  if (st.size() == 2 && n % 3 == 0) {
    int check = a[0];
    int cnt1 = 0, cnt2 = 0;
    for (int i = 0; i < n; ++i) {
      if (a[i] == check)
        ++cnt1;
      else
        ++cnt2;
    }
    if ((cnt1 == n / 3 && cnt2 == n * 2 / 3) ||
        (cnt1 == n * 2 / 3 && cnt2 == n / 3))
      ok = true;
  }
  if (st.size() == 1 && a[0] == 0) ok = true;
  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}
