#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, tmp, types = 0;
  int key[3] = {-1, -1, -1};
  map<int, int> cnt;
  cin >> n;
  vector<int> a;
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    a.push_back(tmp);
  }
  for (int i = 0; i < n; i++) {
    auto itr = cnt.find(a[i]);
    if (itr != cnt.end())
      itr->second++;
    else {
      if (types >= 3) {
        types = 4;
        break;
      } else {
        cnt.insert(make_pair(a[i], 1));
        key[types] = itr->first;
        types++;
      }
    }
  }
  if (types == 3) {
    int _cnt = cnt.find(key[0])->second;
    if (cnt.find(key[1])->second == _cnt && cnt.find(key[2])->second == _cnt)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  } else
    cout << "No" << endl;
  return 0;
}
