#include <bits/stdc++.h>
using ll = long long;
int const nmax = 100000;
std::map<int, int> frec;
int v[5 + nmax];
int main() {
  int n;
  std::cin >> n;
  for (int i = 1; i <= n; i++) std::cin >> v[i];
  for (int i = 1; i <= n; i++) frec[v[i]]++;
  int verdict = 1;
  if (0 < (n % 3))
    verdict = (frec[v[1]] == n);
  else {
    for (int i = 1; i <= n; i++)
      if (0 < (frec[v[i]] % (n / 3))) verdict = 0;
  }
  if (verdict == 1)
    std::cout << "Yes";
  else
    std::cout << "No";
  return 0;
}
