#include <bits/stdc++.h>
using namespace std;
long long mod(long long a) {
  long long c = a % (long long)(1E9 + 7);
  if (c >= 0) return c;
  return c + (long long)(1E9 + 7);
}
long long inf = (long long)1E16;
long long max(long long a, long long b) {
  if (a < b)
    return b;
  else
    return a;
}
long long min(long long a, long long b) {
  if (a > b)
    return b;
  else
    return a;
}
void Max(long long &pos, long long val) { pos = max(pos, val); }
void Min(long long &pos, long long val) { pos = min(pos, val); }
void Add(long long &pos, long long val) { pos = mod(pos + val); }
long double EPS = 1E-9;
string alp = "abcdefghijklmnopqrstuvwxyz";
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i <= n - 1; i++) cin >> a[i];
  if (n % 3 != 0) {
    cout << "No"
         << "\n";
  } else {
    unordered_map<long long, long long> mp;
    vector<long long> num;
    for (long long i = 0; i <= n - 1; i++) {
      if (mp.find(a[i]) == mp.end()) {
        num.push_back(a[i]);
        mp[a[i]] = 1;
      } else {
        mp[a[i]]++;
      }
    }
    if (num.size() == 1) {
      cout << "Yes"
           << "\n";
    } else if (num.size() == 2) {
      if (mp[num[0]] == n / 3 && mp[num[1]] == 2 * n / 3) {
        cout << "Yes"
             << "\n";
      } else if (mp[num[1]] == n / 3 && mp[num[0]] == 2 * n / 3) {
        cout << "Yes"
             << "\n";
      } else {
        cout << "No"
             << "\n";
      }
    } else if (num.size() == 3) {
      if (mp[num[0]] == n / 3 && mp[num[1]] == n / 3 && mp[num[2]] == n / 3) {
        cout << "Yes"
             << "\n";
      } else {
        cout << "No"
             << "\n";
      }
    } else {
      cout << "No"
           << "\n";
    }
  }
  return 0;
}
