#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  if (n % 3 == 0) {
    vector<int> a(n);
    set<int> s;
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      a[i] = x;
      s.insert(x);
    }
    if (s.size() == 3) {
      sort(a.begin(), a.end());
      if (a[n / 3 - 1] != a[n / 3] && a[n / 3 * 2 - 1] != a[n / 3 * 2]) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}
