#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

#define cin in
int main() {
  int N;
  cin >> N;
  map<int, int> mp;
  rep(i, N) {
    int tmp;
    cin >> tmp;
    mp[tmp]++;
  }
  if (mp.size() > 3)
    cout << "No" << endl;
  else if (mp.size() == 3 && !(N%3)) {
    for (auto e : mp) {
      if (e.second != N/3) {
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;
  } else if (mp.size() == 2 && !(N%3)) {
    for (auto e : mp) {
      if (e.second%(N/3)) {
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;
  } else {
    if (mp[0] == mp.size())
      cout << "Yes" << endl;
    else
      cout << "No" << endl; 
  }
  return 0;
}