#include <bits/stdc++.h>
using namespace std;
int n, A[100];
bool check1() {
  for (int i = 0; i < n; i++) {
    if (A[i] != 0) return 0;
  }
  return 1;
}
bool check2() {
  int x = -1;
  int cnt_0 = 0, cnt_x = 0;
  for (int i = 0; i < n; i++) {
    if (A[i] != 0 && x == -1) {
      x = A[i];
    }
    if (A[i] != 0 && A[i] != x) return 0;
    if (A[i] == 0) cnt_0++;
    if (A[i] == x) cnt_x++;
  }
  return cnt_0 == 2 * n / 3 && cnt_x == n / 3;
}
bool check3() {
  int x = A[0], y = -1, z = -1, cnt_x = 0, cnt_y = 0, cnt_z = 0;
  for (int i = 0; i < n; i++) {
    if (A[i] != x && y == -1) y = A[i];
    if (A[i] != x && A[i] != y && y != -1 && z == -1) z = A[i];
    if (A[i] != x && A[i] != y && A[i] != z) return 0;
    if (A[i] == x) cnt_x++;
    if (A[i] == y) cnt_y++;
    if (A[i] == z) cnt_z++;
  }
  return cnt_x == cnt_y == cnt_z == n / 3;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  if (check1() || check2() || check3())
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
