#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, k = 0;
  cin >> N;
  vector<int> a(N);
  vector<int> num(N);
  vector<int> count(3, 0);
  if (N % 3 != 0) {
    cout << "No" << endl;
    return 0;
  }
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  num[k] = a[0];
  for (int i = 1; i < N; i++) {
    if (a[i] != num[k]) num[++k] = a[i];
  }
  if (k > 2) {
    cout << "No" << endl;
    return 0;
  }
  for (int j = 0; j < 3; j++) {
    for (int i = 0; i < N; i++) {
      if (a[i] == num[j]) count[j]++;
    }
  }
  if (count[0] == count[1] && count[0] == count[2]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
