#include <bits/stdc++.h>
using namespace std;
void Main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto &ai : a) {
    cin >> ai;
  }
  if (n % 3 != 0) {
    for (int i = 0; i < n; ++i) {
      if (a[i] != 0) {
        cout << "No\n";
        return;
      }
    }
    cout << "Yes\n";
    return;
  } else {
    vector<int> val;
    vector<int> cnt;
    for (int i = 0; i < n; ++i) {
      auto itr = find(val.begin(), val.end(), a[i]);
      if (itr == val.end()) {
        val.push_back(a[i]);
        cnt.push_back(0);
      } else {
        ++cnt[distance(val.begin(), itr)];
      }
    }
    if (val.size() == 2) {
      sort(val.begin(), val.end());
      if ((val[0] == 0 && cnt[0] == cnt[1] * 2) ||
          (val[1] == 0 && cnt[0] * 2 == cnt[1])) {
        cout << "Yes\n";
        return;
      }
    } else if (val.size() == 3) {
      if (cnt[0] == cnt[1] && cnt[1] == cnt[2]) {
        cout << "Yes\n";
        return;
      }
    }
    cout << "No\n";
    return;
  }
}
int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}
