#include <bits/stdc++.h>
using namespace std;
int main(void) {
  uint32_t N{};
  cin >> N;
  vector<uintmax_t> originalBits(N);
  map<uintmax_t, uintmax_t> mapA{};
  for (size_t i = 0; i < N; ++i) {
    cin >> originalBits[i];
    if (mapA.find(originalBits[i]) == mapA.end()) {
      mapA[originalBits[i]] = 0;
    }
    ++mapA[originalBits[i]];
  }
  vector<uintmax_t> usedBits(N);
  bool ans{true};
  if (mapA.find(0) != mapA.end() && mapA[0] == N) {
    ans = true;
  } else if (N % 3 != 0) {
    ans = false;
  } else {
    for (auto p : mapA) {
      if (p.first == 0) {
        ans &= (p.second == N / 3);
      } else {
        ans &= (p.second == (N * 2) / 3);
      }
    }
  }
  string ans_txt = ans ? "Yes" : "No";
  cout << ans_txt << endl;
  return 0;
}
