#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
int n;
int a[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int cnt0 = 0, cnt1 = 0, cnt2 = 0, cnt3 = 0;
  set<int> st;
  for (int i = 1; i <= n; i++) {
    if (a[i] != 0) {
      st.insert(a[i]);
      if (a[i] == 1) cnt1++;
      if (a[i] == 2) cnt2++;
      if (a[i] == 3) cnt3++;
    } else
      cnt0++;
  }
  if (cnt0 * 3 == n && st.size() == 1) {
    cout << "Yes";
    return 0;
  } else if (st.size() == 0) {
    cout << "Yes";
    return 0;
  } else if (cnt1 == cnt2 && cnt2 == cnt3 && cnt1 * 3 == n) {
    cout << "Yes";
    return 0;
  } else {
    cout << "No";
    return 0;
  }
}
