#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; namespace utils{ #define ALL(x) begin(x), end(x) #define RALL(x) rbegin(x), rend(x) ///----- aliases using ll = long long int; using ull = unsigned long long; template using p_queue = priority_queue, Compare>; template using min_queue = p_queue>; template using max_queue = p_queue>; template inline bool CHMIN(T& X, const T& A){ if(X > A) {X = A; return true;} return false; } template inline bool CHMAX(T& X, const T& A){ if(X < A) {X = A; return true;} return false; } ///----- vector I/O template vector VEC(size_t n, T t){ return vector(n, t); } template auto VEC(size_t n, Ts ... ts){ return vector(n, VEC(ts...)); } template istream& operator>>(istream& is, vector& v){ for (auto &&x : v) { is >> x; } return is; } template ostream& operator<<(ostream& os, const vector& v){ auto p = v.begin(); assert(p != v.end()); os << *p++; while(p != v.end()){ os << ' ' << *p++; } return os ; } template ostream& operator<<(ostream& os, const vector>& v){ auto p = v.begin(); assert(p != v.end()); os << *p++; while(p != v.end()){ os << '\n' << *p++; } return os; } ///----- tuple I/O template istream& operator>>(istream& is, tuple& t){ return is >> get<0>(t) >> get<1>(t); } template istream& operator>>(istream& is, pair& t){ return is >> get<0>(t) >> get<1>(t); } template istream& operator>>(istream& is, tuple& t){ return is >> get<0>(t) >> get<1>(t) >> get<2>(t); } template ostream& operator<<(ostream& os, const tuple& t){ return os << get<0>(t) << ' ' << get<1>(t); } template ostream& operator<<(ostream& os, const pair& t){ return os << get<0>(t) << ' ' << get<1>(t); } template ostream& operator<<(ostream& os, const tuple& t){ return os << get<0>(t) << ' ' << get<1>(t) << ' ' << get<2>(t); } ///----- constants constexpr ll INFLL = 1'000'000'000'000'000'020ll; constexpr ll INF = 1'000'000'009; constexpr double PI = 3.14'159'265'358'979'323'846; constexpr double EPS = 1e-12; } using namespace utils; class solver{ istream& is; ostream& os; public: solver(istream& I, ostream& O) :is(I), os(O) {} int N; vector A; const int amax = 5001; bool input() { N = 0; is >> N; A.resize(N); is >> A; return !!is; } bool skip(){ // 0 \in A if(*min_element(A.begin(), A.end()) == 0){ os << "Yes\n"; return true; } // XOR A =/= 0 if(accumulate(ALL(A), 0, [](int a, int b) { return a ^ b;})){ os << "No\n"; return true; } return false; } bool check(const vector& v) const { // S[i][j]:: i以下でjを作れるか? 0: NG, 1: OK (ALL), 2: OK (PARTIAL) auto S = VEC(amax, 0); int f = 0; for (int i = 1; i < amax; ++i) { if(v[i] == 0) continue; auto nx = VEC(amax, 0); for (int j = 0; j < amax; ++j) { nx[j] = S[j] > 0 ? 2 : 0; if((i^j) <= amax){ CHMAX(nx[j], S[i^j]); } } // end j nx[i] = (f > 0) + 1; f++; S = std::move(nx); } // end i return S[0] == 2; } void run(); }; void solver::run(){ if(!input()) return; if(skip()) return; // XOR A == 0 vector bn(amax); for (auto &&a: A) { bn[a]++; if(bn[a] >= 2){ os << "Yes\n"; return; } } // end a os << (check(bn) ? "Yes\n" : "No\n"); } int main(int argc, char *argv[]) { cin.tie(nullptr); ios::sync_with_stdio(false); cout << setprecision(16) << scientific; #ifdef XELMH string test_cases = "test_b.txt"; cerr << test_cases << " -->" << endl; auto fs = fstream(test_cases, fstream::in); int loop = 0; while(fs) { loop++; cout << '#' << loop << "#------\n"; solver(fs, cout).run(); } if(loop <= 1) { cout << "===" << endl; while(cin) solver(cin, cout).run(); } #else solver(cin, cout).run(); #endif return 0; }