#include #include using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000001 int main(){ int N; cin>>N; int s,e; N += 2; cin>>s>>e; vector x(N); x[0] = s; x.back() = e; rep(i,N-2){ cin>>x[i+1]; } map mp; rep(i,N){ mp[x[i]] = i; } vector dis(N,Inf); dis[0] = 0; queue Q; Q.push(0); while(Q.size()>0){ int u = Q.front(); Q.pop(); rep(i,30){ int v = x[u] ^ (1<