#include <bits/stdc++.h>
int main(void) {
  int N;
  std::cin >> N;
  std::vector<long long> a(N);
  for (int i = 0; i < N; i++) std::cin >> a[i];
  std::unordered_map<long long, int> k;
  for (int i = 0; i < N; i++) {
    if (k.count(a[i]) == 0)
      k[a[i]] = 1;
    else
      k[a[i]]++;
  }
  if (k.size() > 3) {
    std::cout << "No" << std::endl;
    return 0;
  }
  if (k.size() == 1) {
    std::cout << "Yes" << std::endl;
    return 0;
  }
  if (k.size() == 2) {
    if (N % 3 == 0) {
      bool flag = false;
      for (auto itr = k.begin(); itr != k.end(); ++itr) {
        if (itr->second == N / 3) flag = true;
      }
      if (flag) {
        std::cout << "Yes" << std::endl;
        return 0;
      }
    }
    std::cout << "No" << std::endl;
    return 0;
  }
  if (k.size() == 3) {
    if (N % 3 == 0) {
      for (auto itr = k.begin(); itr != k.end(); ++itr) {
        if (itr->second != N / 3) {
          std::cout << "No" << std::endl;
          return 0;
        }
      }
      std::cout << "Yes" << std::endl;
      return 0;
    }
    std::cout << "No" << std::endl;
    return 0;
  }
  return 0;
}
