import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.NoSuchElementException; import java.util.TreeSet; public class Main{ public static void main(String[] args) { new Main().solve(); } void gen() { int N=200000; int P=1; int Q=N; int[] a=new int[N]; for (int i=0;i=0;--i) if (A[i]==key) return i; throw new AssertionError(); } void solve() { FastScanner sc=new FastScanner(); int N=sc.nextInt(); int P=sc.nextInt(); int Q=sc.nextInt(); int[] A=new int[N]; for (int i=0;i ts=new TreeSet<>(); int max=0; int iq=find(A, Q); for (int i=N-1;i>=iq;--i) { ts.add(A[i]); max=Math.max(max, A[i]); } if (max==Q) { while (iq>=0 && (ts.ceiling(A[iq]+1)==null || ts.ceiling(A[iq]+1)==Q)) { --iq; if (iq>=0) ts.add(A[iq]); } } Arrays.sort(A, iq+1, N); { int s=iq+1; int t=N-1; while (s0&&A[iq-1]==Q)) break; } int ip=find(A, P); int iq=find(A, Q); for (int i=iq;i0 && a[p-1]>a[p]) --p; if (p==0) return false; int q=p; while (q+1