#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e5 + 100;
long long n, a[MAXN];
map<long long, int> mp;
vector<long long> g;
int main() {
  cin >> n;
  long long col = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    mp[a[i]]++;
    if (mp[a[i]] == 1) {
      col++;
      g.push_back(a[i]);
    }
  }
  if (col == 1) {
    cout << "Yes";
    return 0;
  }
  if (g.size() != 3) {
    cout << "No";
    return 0;
  }
  if (n % 3 != 0) {
    cout << "No";
    return 0;
  }
  if (mp[g[0]] == mp[g[1]] && mp[g[0]] == mp[g[2]]) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}
