#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
void mad(long long &a, long long b) {
  a = (a + b) % 1000000007;
  if (a < 0) a += 1000000007;
}
long long gcd(long long a, long long b) {
  if (a > b) swap(a, b);
  if (!a) return b;
  return gcd(b % a, a);
}
void solve() {
  int n;
  cin >> n;
  int a[n];
  map<int, int> mp;
  int c = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (mp[a[i]] == 0) c++;
    mp[a[i]]++;
  }
  if (n % 3) {
    cout << "No";
    return;
  }
  if (c > 3 || c == 1) {
    cout << "No";
    return;
  }
  int x = mp[a[0]];
  for (int i = 0; i < n; i++)
    if (mp[a[i]] != x) {
      cout << "No";
      return;
    }
  cout << "Yes";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  t = 1;
  while (t--) {
    solve();
  }
}
