#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  map<long long, long long> mp;
  vector<long long> v;
  long long A[N];
  for (long long i = 0; i < (long long)(N); i++) {
    cin >> A[i];
    if (mp.count(A[i]))
      mp[A[i]]++;
    else {
      v.push_back(A[i]);
      mp.emplace(A[i], 1);
    }
  }
  sort(v.begin(), v.end());
  string out = "No";
  if (v.size() == 1 && v[0] == 0)
    out = "Yes";
  else if (N % 3 == 0) {
    if (v.size() == 2 && v[0] == 0 && mp[0] == N / 3)
      out = "Yes";
    else if (v.size() == 3) {
      out = "Yes";
      for (long long i = 0; i < (long long)(N - 3); i++) {
        if (A[i] != A[i + 3]) {
          out = "No";
          break;
        }
      }
    }
  }
  cout << out << endl;
  return 0;
}
