#include <bits/stdc++.h>
using namespace std;
inline void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
inline void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
inline void Yay(bool b) { cout << (b ? "Yay!" : ":(") << endl; }
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(15);
  int N;
  cin >> N;
  map<long long, int> mp;
  for (int i = 0, i_max = (N); i < i_max; ++i) {
    long long x;
    cin >> x;
    ++mp[x];
  }
  bool issat = false;
  if (mp.count(0) && mp.size() == 3) {
    int num = mp[0];
    for (auto itr = mp.begin(); itr != mp.end(); ++itr)
      if (itr->first != 0 && itr->second == 2 * num) issat = true;
  } else if (mp.size() == 3) {
    issat = true;
    int num = 0;
    for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
      if (itr == mp.begin())
        num = itr->second;
      else if (itr->second != num)
        issat = false;
    }
  }
  YesNo(issat);
  return 0;
}
