#include using namespace std; using ull = unsigned long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector a(1 << n); cin >> a[0]; if(a[0]){ cout << "No" << '\n'; return 0; } for(int i = 1; i < (1 << n); i++){ cin >> a[i]; int b = 1 << __lg(i); if(a[i ^ b] ^ a[i] ^ a[b]){ cout << "No" << '\n'; return 0; } } cout << "Yes" << '\n'; }