#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
template <class T, class U>
bool cmax(T& a, U b) {
  if (a < b) {
    a = b;
    return true;
  } else
    return false;
}
template <class T, class U>
bool cmin(T& a, U b) {
  if (a > b) {
    a = b;
    return true;
  } else
    return false;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vl a(n);
  map<ll, int> s;
  bool flag = 1;
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
    s[a[i]]++;
    if (a[i] != 0) flag = 0;
  }
  if (flag)
    cout << "Yes" << endl;
  else if (s.size() != 3)
    cout << "No" << endl;
  else {
    int i = 0;
    vector<int> v(3);
    for (auto&& j : s) {
      v[i++] = j.second;
    }
    if (!(v[0] == v[1] && v[1] == v[2])) {
      puts("No");
      return 0;
    }
    for (ll i = 0; i < 41; i++) {
      int cnt = 0;
      cerr << i << endl;
      for (auto&& j : s) {
        if (j.first & (1LL << i)) cnt++;
      }
      if (cnt != 2 && cnt != 0) {
        puts("No");
        return 0;
      }
    }
    puts("Yes");
  }
}
