#include #include #include #include using namespace std; constexpr int iINF = 1'000'000'000; int main () { int N; cin >> N; vector A(N); for (int i = 0; i < N; i++) cin >> A[i]; // 全体のxorが0という必要条件 -> 最初にチェックしておけば片側の存在を示せばOK // ダブり -> 即OK int XOR = 0; for (auto a : A) XOR ^= a; if (XOR != 0) { cout << "No\n"; return 0; } map mp; for (auto a : A) mp[a]++; for (auto v : mp) { if (2 <= v.second) { cout << "Yes\n"; return 0; } } bool ok = true; const int MAX = 20000; vector> possible(mp.size() + 1, vector(MAX + 1, iINF)); int cur = 0; for (auto v : mp) { for (int i = 0; i <= MAX; i++) { possible[cur + 1][i] = possible[cur][i]; } for (int i = 0; i <= MAX; i++) { if (possible[cur][i] == iINF) continue; possible[cur + 1][i ^ v.first] = min(possible[cur + 1][i ^ v.first], possible[cur][i] + 1); } possible[cur + 1][v.first] = 1; cur++; } assert(possible[cur][0] == N); if (N <= possible[cur][0]) ok = false; if (ok) { cout << "Yes\n"; } else { cout << "No\n"; } }