#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 (N == 0){ if (A[0] == 0){ cout << "Yes" << endl; return 0; } else { cout << "No" << endl; return 0; } } bool ok = true; for (int i = 0; i < 64; i++){ vector B(1 << N); for (int j = 0; j < (1 << N); j++){ B[j] = A[j] & (1LL << i); } bool ok2 = true; for (int j = 0; j < (1 << N); j++){ if (B[j] != B[(1 << N) - 1 - j]){ ok2 = false; } } if (ok2){ continue; } ok2 = true; for (int j = 0; j < (1 << N) / 2; j++){ if (B[j] != B[(1 << N) / 2 + j]){ ok2 = false; } } if (ok2){ continue; } ok = false; } if (ok){ cout << "Yes" << endl; } else { cout << "No" << endl; } }