#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 = false; for (int j = 0; j < N; j++){ set> s; vector C; for (int k = 0; k < (1 << N); k++){ C.push_back(B[k]); if ((int) C.size() == (1 << j)){ s.insert(C); C.clear(); } } if ((int) s.size() == 1){ ok2 = true; break; } } if (ok2){ continue; } ok = false; break; } if (ok){ cout << "Yes" << endl; } else { cout << "No" << endl; } }