#include <bits/stdc++.h>
using namespace std;
long long n, a[100008];
int main() {
  cin >> n;
  map<long long, long long> mp;
  string ans;
  if (n % 3 != 0) {
    ans = "Yes";
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      if (a[i] != 0) {
        ans = "No";
      }
    }
  } else {
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      auto itr = mp.find(a[i]);
      if (itr != mp.end()) {
        (itr->second)++;
      } else {
        mp[a[i]] = 1;
      }
    }
    if (mp.size() > 3) {
      ans = "No";
    } else {
      if (mp.size() == 3) {
        ans = "No";
      }
      if (mp.size() == 2) {
        ans = "No";
        auto itr = mp.begin();
        long long a = itr->first;
        long long ca = itr->second;
        itr++;
        long long b = itr->first;
        long long cb = itr->second;
        if (2 * ca == cb || ca == 2 * cb) {
          ans = "Yes";
          if (ca < cb) {
            long long tmp = a;
            a = b;
            b = tmp;
          }
          for (long long k = 0; k <= 50; k++) {
            bool ba = a & (1 << k);
            bool bb = b & (1 << k);
            if ((ba && bb) && (!ba && bb)) {
              ans = "No";
            }
          }
        } else {
          ans = "No";
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
