#ifndef LOCAL
#include "bits/stdc++.h"
#endif
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll;
template<class T>using vv = vector<vector<T>>; template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    bool ans = true;
    set<int> s;
    rep(i, N) s.insert(A[i]);

    if (s.size() > 3) {
        ans = false;
    }
    else if (s.size() == 3) {
        auto it = s.begin();
        vector<int> a = { *it, *(++it), *(++it) };

        rep(i, 31) {
            int b0 = 0, b1 = 0;
            for (int n : a) {
                if (n >> i & 1) b1++;
                else b0++;
            }

            if (b0 == 3 || (b0 == 1 && b1 == 2));
            else ans = false;
        }
    }
    else if (s.size() == 2) {
        auto it = s.begin();
        int a = *it, b = *(++it);
        if (a > b) swap(a, b);

        if (a != 0) ans = false;

        rep(i, 31) {
            if (b >> i & 1) continue;
            else {
                if (b >> i) ans = false;
            }
        }
    }
    else {
        if (*(s.begin()) != 0) ans = false;
    }

    write(ans ? "Yes" : "No");
}