#include #ifdef LOCAL #include "./debug.cpp" #else #define debug(...) #define print_line #endif using namespace std; using ll = long long; int main() { int N; cin >> N; vector A(N); for (int i = 0; i < N; i++) { cin >> A[i]; } int xors = 0; for (int i = 0; i < N; i++) { xors ^= A[i]; } if (xors != 0) { cout << "No" << endl; return 0; } if (N > 5000) { cout << "Yes" << endl; return 0; } int mx = 5000; vector> dp(mx + 1, vector(2, false)); dp[A[0]][1] = true; for (int i = 0; i < N - 1; i++) { vector> ndp(mx + 1, vector(2, false)); for (int j = 0; j <= mx; j++) { for (int k = 0; k < 2; k++) { if (dp[j][k]) { ndp[j][0] = true; if ((j ^ A[i + 1]) <= mx) { ndp[j ^ A[i + 1]][k] = true; } } } } swap(dp, ndp); } if (dp[0][0]) { cout << "Yes" << endl; } else { cout << "No" << endl; } }