#include <bits/stdc++.h>
using namespace std;
template <typename T, typename V>
ostream &operator<<(ostream &os, const pair<T, V> pai) {
  return os << '(' << pai.first << ' ' << pai.second << ')';
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> v) {
  cout << '[';
  for (auto p : v) cout << p << ",";
  cout << "]";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> v) {
  cout << "{";
  for (auto p : v) cout << p << ",";
  cout << "}";
  return os;
}
template <typename T, typename V>
ostream &operator<<(ostream &os, const map<T, V> v) {
  cout << "{";
  for (auto p : v) cout << p << ",";
  cout << "}";
  return os;
}
template <typename T>
void get_max(T &a, T b) {
  a = max(a, b);
}
template <typename T>
void get_min(T &a, T b) {
  a = min(a, b);
}
int N;
int A[100000];
void print(bool res) {
  if (res)
    cout << "Yes" << '\n';
  else
    cout << "No" << '\n';
  exit(0);
}
int main(void) {
  iostream::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  cin >> N;
  for (int i = 0, _i = (N); i < _i; i++) cin >> A[i];
  if (N % 3 == 0) {
    sort(A, A + N);
    vector<int> r;
    for (int i = 0, _i = (N); i < _i; i++)
      if (i == 0 or A[i - 1] != A[i]) {
        r.push_back(1);
      } else {
        r.back()++;
      }
    print(count((r).begin(), (r).end(), N / 3) == 3);
  } else {
    print(count(A, A + N, A[0]) == N);
  }
}
