#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
long long powmod(long long x, long long n) {
  long long ret = 1;
  while (n > 0) {
    if (n & 1) ret = ret * x % 1000000007;
    x = x * x % 1000000007;
    n >>= 1;
  }
  return ret;
}
long long ctoi(char c) {
  switch (c) {
    case '0':
      return 0;
    case '1':
      return 1;
    case '2':
      return 2;
    case '3':
      return 3;
    case '4':
      return 4;
    case '5':
      return 5;
    case '6':
      return 6;
    case '7':
      return 7;
    case '8':
      return 8;
    case '9':
      return 9;
    default:
      return 0;
  }
}
long long gcd(long long a, long long b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
bool isPrime(long long x) {
  long long i;
  if (x < 2)
    return 0;
  else if (x == 2)
    return 1;
  if (x % 2 == 0) return 0;
  for (i = 3; i * i <= x; i += 2)
    if (x % i == 0) return 0;
  return 1;
}
map<long long, long long> prime_factor(long long n) {
  map<long long, long long> ret;
  for (long long i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
long long nCr(long long n, long long r) {
  long long x = 1, y = 1;
  for (long long i = 0; i < r; i++) {
    x = x * (n - i) % 1000000007;
    y = y * (i + 1) % 1000000007;
  }
  return x * powmod(y, 1000000007 - 2) % 1000000007;
}
long long dhh[4] = {1, 0, -1, 0};
long long dww[4] = {0, 1, 0, -1};
vector<long long> A(105, -1);
vector<long long> B(105, -1);
long long a, b, c;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long N;
  cin >> N;
  vector<long long> a(N);
  for (long long i = 0; i < long long(N); i++) {
    cin >> a[i];
  }
  bool ok = true;
  if (N % 3 != 0) {
    long long aa = a[0];
    for (long long i = 0; i < long long(N); i++) {
      if (a[i] != aa) {
        ok = false;
      }
    }
  } else {
    map<long long, long long> mp;
    for (long long i = 0; i < long long(N); i++) {
      mp[a[i]]++;
    }
    if (mp.size() == 3) {
      long long x[3];
      long long i = 0;
      for (auto m : mp) {
        x[i] = m.second;
        i++;
      }
      if (x[0] == x[1] && x[1] == x[2])
        ok = true;
      else
        ok = false;
    } else
      ok = false;
  }
  if (ok) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  };
  return 0;
}
