#include <bits/stdc++.h>
using namespace std;
template <class T>
void cout_vec(const vector<T> &vec) {
  for (auto itr : vec) cout << itr << ' ';
  cout << '\n';
}
const long long mod = 1e9 + 7;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<long long> a(n);
  set<long long> cnt;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    cnt.insert(a[i]);
  }
  if (n % 3 != 0 && long long(cnt.size()) != 1)
    cout << "No" << endl;
  else {
    if (n % 3 == 0 && long long(cnt.size()) > 3)
      cout << "No" << endl;
    else
      cout << "Yes" << endl;
  }
}
