J=lambda:map(int,input().split()) N,*_=J() A=list(J()) l=r=A[0] for i in range(N): if A[i]r:A[i],r=r,A[i] while not A[i]in[l,r]: if A[i]*2