/* -*- coding: utf-8 -*- * * 2672.cc: No.2672 Subset Xor Sum - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 500000; const int BN = 13; const int BBITS = 1 << BN; /* typedef */ /* global variables */ int as[MAX_N], cs[BBITS]; bool dp[BBITS]; /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", as + i); int sum = 0; for (int i = 0; i < n; i++) cs[as[i]]++, sum ^= as[i]; if (sum != 0 || (n == 2 && cs[0] == 0)) { puts("No"); return 0; } if (cs[0] > 0) { puts("Yes"); return 0; } for (int i = 1; i < BBITS; i++) if (cs[i] >= 2) { puts("Yes"); return 0; } dp[0] = true; for (int i = 0; i < n; i++) for (int j = BBITS - 1; j >= 0; j--) if (dp[j]) { int v = j ^ as[i]; dp[v] = true; if (v == 0 && i < n - 1) { puts("Yes"); return 0; } } puts("No"); return 0; }