#include <bits/stdc++.h>
using namespace std;
vector<bool> seen;
const long long int MOD = 1e9 + 7;
const int INF = -1;
struct _chunk {
  int connect;
  int dist;
  int color;
};
signed main(void) {
  int N;
  vector<int> a;
  vector<int> b;
  int num[3];
  int flag = false;
  for (int i = 0; i < 3; i++) {
    num[i] = 0;
  }
  cin >> N;
  for (int i = 0; i < N; i++) {
    if (flag == true) break;
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
    if (i == 0) {
      b.push_back(tmp);
      num[0]++;
    } else {
      bool find = false;
      for (int j = 0; j < b.size(); j++) {
        if (tmp == b[j]) {
          num[j]++;
          find = true;
          break;
        }
      }
      if (!find) {
        b.push_back(tmp);
        if (b.size() > 3) {
          flag = true;
        } else {
          num[b.size() - 1]++;
        }
      }
    }
  }
  if (flag == false && num[0] == num[1] && num[1] == num[2] && b.size() == 3) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
