#include #include #include #include using namespace std; using namespace atcoder; using namespace __gnu_pbds; using ll=long long; using ld=long double; using vll=vector; using vvll=vector; using pll=pair; // using mint=modint; // template // using ordered_map=tree,rb_tree_tag,tree_order_statistics_node_update>; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll N; cin>>N; vll stone(N+2); for(int i=0;i>stone[i]; unordered_mapid; for(int i=0;iq; d[0]=0; q.push(0); while(!q.empty()){ ll u=q.front(); ll y=stone[u]; q.pop(); for(int b=0;b<30;++b){ ll x=y^(1LL<