import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        int[] A = new int[M+1];
        for(int i=1;i<=M;i++) A[i]=sc.nextInt();
        int pos = 0;
        while(X>A[pos]) pos++;
        int ans = Math.min(pos-1,M-(pos-1));
        System.out.println(ans);
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        int[] A = new int[M+1];
        for(int i=1;i<=M;i++) A[i]=sc.nextInt();
        int pos = 0;
        while(X>A[pos]) pos++;
        int ans = Math.min(pos-1,M-(pos-1));
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        int[] A = new int[M+1];
        for(int i=1;i<=M;i++) A[i]=sc.nextInt();
        int pos = 0;
        while(X>A[pos]) pos++;
        int ans = Math.min(pos-1,M-(pos-1));
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        int[] A = new int[M+1];
        for(int i=1;i<=M;i++) A[i]=sc.nextInt();
        int pos = 0;
        while(X>A[pos]) pos++;
        int ans = Math.min(pos-1,M-(pos-1));
        System.out.println(ans);
    } 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+1]; A new int[M+1] M+1 M 1 for(int i=1;i<=M;i++) A[i]=sc.nextInt(); int i=1; int i=1; i 1 i<=M i M i++ i++ i A[i]=sc.nextInt(); A[i]=sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc int pos = 0; pos 0 while(X>A[pos]) pos++; X>A[pos] X A[pos] A pos pos++ pos int ans = Math.min(pos-1,M-(pos-1)); ans Math.min(pos-1,M-(pos-1)) Math.min Math pos-1 pos 1 M-(pos-1) M (pos-1) pos 1 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        int[] A = new int[M+1];
        for(int i=1;i<=M;i++) A[i]=sc.nextInt();
        int pos = 0;
        while(X>A[pos]) pos++;
        int ans = Math.min(pos-1,M-(pos-1));
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        int[] A = new int[M+1];
        for(int i=1;i<=M;i++) A[i]=sc.nextInt();
        int pos = 0;
        while(X>A[pos]) pos++;
        int ans = Math.min(pos-1,M-(pos-1));
        System.out.println(ans);
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        int[] A = new int[M+1];
        for(int i=1;i<=M;i++) A[i]=sc.nextInt();
        int pos = 0;
        while(X>A[pos]) pos++;
        int ans = Math.min(pos-1,M-(pos-1));
        System.out.println(ans);
    }
}