#include <bits/stdc++.h>
using namespace std;
const long long MX = 1e6;
const long long inf = 1e13;
const long long mod = 1e9 + 7;
signed main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = (0); i < (n); ++i) cin >> a[i];
  set<long long> s;
  for (long long i = (0); i < (n); ++i) {
    s.insert(a[i]);
  }
  if (s.size() == 1) {
    for (auto m : s) {
      if (m == 0) {
        cout << "Yes" << endl;
        return 0;
      } else {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  if (s.size() == 2) {
    bool f = false;
    for (auto m : s) {
      if (m == 0) f = true;
    }
    if (!f)
      cout << "No" << endl;
    else {
      long long cnt = 0;
      for (long long i = (0); i < (n); ++i) {
        if (a[i] == 0) cnt++;
      }
      if (n % 3 == 0 && cnt == n / 3) {
        cout << "Yes" << endl;
      } else
        cout << "No" << endl;
    }
    return 0;
  }
  if (n % 3 == 0 && s.size() == 3) {
    vector<long long> b;
    for (auto m : s) {
      b.push_back(m);
    }
    vector<long long> c(3);
    for (long long i = (0); i < (n); ++i) {
      if (b[0] == a[i]) c[0]++;
      if (b[1] == a[i]) c[1]++;
      if (b[2] == a[i]) c[2]++;
    }
    if (b[0] ^ b[1] ^ b[2] == 0 && c[0] == n / 3 && c[1] == n / 3 &&
        c[2] == n / 3) {
      return 0;
    }
  }
  return 0;
}
