import java.util.Scanner;




public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {
    	Scanner sc=new Scanner(System.in);

    	int N=sc.nextInt();
    	int M=sc.nextInt();
    	int X=sc.nextInt();

    	int[] A=new int[M];

    	for(int i=0;i<M;i++) {
    		A[i]=sc.nextInt();
    	}

    	int counter=0;
    	for(int i=0;i<M;i++) {
    		if(X>A[i]) {
    			counter++;
    		}else {
    			break;
    		}
    	}

    	int cost=Math.min(counter,A.length-counter);

    	System.out.println(cost);


    }



}
 import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {
    	Scanner sc=new Scanner(System.in);

    	int N=sc.nextInt();
    	int M=sc.nextInt();
    	int X=sc.nextInt();

    	int[] A=new int[M];

    	for(int i=0;i<M;i++) {
    		A[i]=sc.nextInt();
    	}

    	int counter=0;
    	for(int i=0;i<M;i++) {
    		if(X>A[i]) {
    			counter++;
    		}else {
    			break;
    		}
    	}

    	int cost=Math.min(counter,A.length-counter);

    	System.out.println(cost);


    }



} Main public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    } main {

    	Main main=new Main();

    	main.run();

    } Main main=new Main(); main new Main() main.run() main.run main String[] args args void run() {
    	Scanner sc=new Scanner(System.in);

    	int N=sc.nextInt();
    	int M=sc.nextInt();
    	int X=sc.nextInt();

    	int[] A=new int[M];

    	for(int i=0;i<M;i++) {
    		A[i]=sc.nextInt();
    	}

    	int counter=0;
    	for(int i=0;i<M;i++) {
    		if(X>A[i]) {
    			counter++;
    		}else {
    			break;
    		}
    	}

    	int cost=Math.min(counter,A.length-counter);

    	System.out.println(cost);


    } run {
    	Scanner sc=new Scanner(System.in);

    	int N=sc.nextInt();
    	int M=sc.nextInt();
    	int X=sc.nextInt();

    	int[] A=new int[M];

    	for(int i=0;i<M;i++) {
    		A[i]=sc.nextInt();
    	}

    	int counter=0;
    	for(int i=0;i<M;i++) {
    		if(X>A[i]) {
    			counter++;
    		}else {
    			break;
    		}
    	}

    	int cost=Math.min(counter,A.length-counter);

    	System.out.println(cost);


    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int N=sc.nextInt(); N sc.nextInt() sc.nextInt sc int M=sc.nextInt(); M sc.nextInt() sc.nextInt sc int X=sc.nextInt(); X sc.nextInt() sc.nextInt sc int[] A=new int[M]; A new int[M] M for(int i=0;i<M;i++) {
    		A[i]=sc.nextInt();
    	} int i=0; int i=0; i 0 i<M i M i++ i++ i {
    		A[i]=sc.nextInt();
    	} {
    		A[i]=sc.nextInt();
    	} A[i]=sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc int counter=0; counter 0 for(int i=0;i<M;i++) {
    		if(X>A[i]) {
    			counter++;
    		}else {
    			break;
    		}
    	} int i=0; int i=0; i 0 i<M i M i++ i++ i {
    		if(X>A[i]) {
    			counter++;
    		}else {
    			break;
    		}
    	} {
    		if(X>A[i]) {
    			counter++;
    		}else {
    			break;
    		}
    	} if(X>A[i]) {
    			counter++;
    		}else {
    			break;
    		} X>A[i] X A[i] A i {
    			counter++;
    		} counter++ counter {
    			break;
    		} break; int cost=Math.min(counter,A.length-counter); cost Math.min(counter,A.length-counter) Math.min Math counter A.length-counter A.length A A.length counter System.out.println(cost) System.out.println System.out System System.out cost public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {
    	Scanner sc=new Scanner(System.in);

    	int N=sc.nextInt();
    	int M=sc.nextInt();
    	int X=sc.nextInt();

    	int[] A=new int[M];

    	for(int i=0;i<M;i++) {
    		A[i]=sc.nextInt();
    	}

    	int counter=0;
    	for(int i=0;i<M;i++) {
    		if(X>A[i]) {
    			counter++;
    		}else {
    			break;
    		}
    	}

    	int cost=Math.min(counter,A.length-counter);

    	System.out.println(cost);


    }



} public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {
    	Scanner sc=new Scanner(System.in);

    	int N=sc.nextInt();
    	int M=sc.nextInt();
    	int X=sc.nextInt();

    	int[] A=new int[M];

    	for(int i=0;i<M;i++) {
    		A[i]=sc.nextInt();
    	}

    	int counter=0;
    	for(int i=0;i<M;i++) {
    		if(X>A[i]) {
    			counter++;
    		}else {
    			break;
    		}
    	}

    	int cost=Math.min(counter,A.length-counter);

    	System.out.println(cost);


    }



} Main
import java.util.Scanner;




public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {
    	Scanner sc=new Scanner(System.in);

    	int N=sc.nextInt();
    	int M=sc.nextInt();
    	int X=sc.nextInt();

    	int[] A=new int[M];

    	for(int i=0;i<M;i++) {
    		A[i]=sc.nextInt();
    	}

    	int counter=0;
    	for(int i=0;i<M;i++) {
    		if(X>A[i]) {
    			counter++;
    		}else {
    			break;
    		}
    	}

    	int cost=Math.min(counter,A.length-counter);

    	System.out.println(cost);


    }



}

