#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  bool ok = true;
  if (n % 3 != 0) {
    for (int i = 1; i < n; i++) {
      if (a[i] != a[0]) ok = false;
    }
  } else {
    for (int i = 0; i < n; i++) {
      if (a[i] != a[i - i % (n / 3)]) ok = false;
    }
  }
  cout << (ok ? "Yes" : "No");
  return 0;
}
