#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]; } bool ans = true; ans &= A[0] == 0; for (int i = 0; i < (1 << n) - 1; i++) { ans &= A[i ^ (i + 1)] == (A[i] ^ A[i + 1]); } cout << (ans ? "Yes" : "No") << endl; }