#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
signed main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  set<long long> kind;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    kind.insert(a[i]);
  }
  bool ok = false;
  if (*max_element((a).begin(), (a).end()) == 0 &&
      *min_element((a).begin(), (a).end()) == 0)
    ok = true;
  if (kind.size() == 2 && n % 3 == 0) {
    sort((a).begin(), (a).end());
    bool ok1 = true;
    for (long long i = 0; i < n / 3; i++) {
      if (a[i] != 0) ok1 = false;
    }
    if (a[n / 3] == 0) ok1 = false;
    if (ok1) ok = true;
  }
  vector<long long> three(3);
  three[0] = *begin(kind);
  kind.erase(*begin(kind));
  three[1] = *begin(kind);
  kind.erase(*begin(kind));
  three[2] = *begin(kind);
  kind.erase(*begin(kind));
  long long p, q, r;
  if (n % 3 == 0 && kind.size() == 0) {
    while (three[2] > 0) {
      p = three[0] % 2;
      q = three[1] % 2;
      r = three[2] % 2;
      three[0] /= 2;
      three[1] /= 2;
      three[2] /= 2;
      if (p + q + r != 0 && p + q + r != 2) break;
      if (three[2] == 0) ok = true;
    }
  }
  if (ok)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
