#include <bits/stdc++.h>
using namespace std;
map<int, int> ima;
int br;
int niz[100005];
int main() {
  ios_base::sync_with_stdio(false);
  cout.precision(10);
  cout << fixed;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> niz[i];
    if (!ima[niz[i]]) br++;
    ima[niz[i]]++;
  }
  if (br != 3) {
    cout << "No";
    return 0;
  }
  int x = ima[niz[1]];
  for (int i = 1; i <= n; i++) {
    if (ima[niz[i]] != x) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}
