#include using namespace std; int main() { int N; cin >> N; vector A(1 << N); for (int i = 0; i < (1 << N); i++) { cin >> A[i]; } if (A[0] != 0){ cout << "No" << endl; return 0; } bool ok = true; for (int i = 0; i < 64; i++){ vector B((1 << N) / 2), C((1 << N) / 2); for (int j = 0; j < (1 << N) / 2; j++){ B[j] = A[j] & (1LL << i); } for (int j = 0; j < (1 << N) / 2; j++){ C[j] = A[(1 << N) / 2 + j] & (1LL << i); } auto B2 = B; auto C2 = C; reverse(B2.begin(), B2.end()); reverse(C2.begin(), C2.end()); if (B == B2 and C == C2){ continue; } for (int j = 0; j < (1 << N) / 2; j++){ B2[j] ^= 1; C2[j] ^= 1; } if (B == B2 and C == C2){ continue; } ok = false; break; } if (ok){ cout << "Yes" << endl; } else { cout << "No" << endl; } }