#include <bits/stdc++.h>
using namespace std;
int n;
bool solve() {
  vector<int> vec;
  unordered_map<int, int> u_map;
  int count = 0;
  if (n % 3) {
    return false;
  }
  int a;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    if (u_map.find(a) == u_map.end()) {
      if (count == 3) {
        return false;
      }
      u_map[a] = 1;
      vec.push_back(a);
      count++;
    } else {
      u_map[a]++;
    }
  }
  for (auto x : vec) {
    if (u_map[x] != (n / 3)) {
      return false;
    }
  }
  return true;
}
int main() {
  cin >> n;
  bool a = solve();
  if (a) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}
