#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2>
inline int chkmin(T1 &x, const T2 &y) {
  if (x > y) {
    x = y;
    return 1;
  } else {
    return 0;
  }
}
template <class T1, class T2>
inline int chkmax(T1 &x, const T2 &y) {
  if (x < y) {
    x = y;
    return 1;
  } else {
    return 0;
  }
}
template <class iterator>
void output(iterator begin, iterator end, ostream &out = cerr) {
  while (begin != end) {
    out << (*begin) << " ";
    begin++;
  }
  out << endl;
}
template <class T>
void output(const T &x, ostream &out = cerr) {
  output(x.begin(), x.end(), out);
}
void fast_io() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
const int MAXN = 100228;
int n;
int a[MAXN];
map<int, int> cnt;
int main() {
  fast_io();
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  if (n % 3 != 0) {
    for (int i = 0; i < n; i++) {
      if (a[i] != a[0]) {
        cout << "No\n";
        exit(0);
      }
    }
  } else {
    for (int i = 0; i < n; i++) {
      cnt[a[i]]++;
    }
    if ((int)(cnt).size() > 3) {
      cout << "No\n";
      exit(0);
    }
    for (auto x : cnt) {
      if (x.second % (n / 3) != 0) {
        cout << "No\n";
        exit(0);
      }
    }
  }
  cout << "Yes\n";
  return 0;
}
