import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);

		int n = stdIn.nextInt();
		int m = stdIn.nextInt();
		int x = stdIn.nextInt();
		int back = 0;
		int go = 0;
		int[] a = new int[m];
		int i;
		for(i = 0; i < m; i++){
			a[i] = stdIn.nextInt();
			if(a[i] < x)
				back++;
			if(x < a[i])
				go++;
                }
		if(back < go)
			System.out.println(back);
		else
			System.out.println(go);
        }
} import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);

		int n = stdIn.nextInt();
		int m = stdIn.nextInt();
		int x = stdIn.nextInt();
		int back = 0;
		int go = 0;
		int[] a = new int[m];
		int i;
		for(i = 0; i < m; i++){
			a[i] = stdIn.nextInt();
			if(a[i] < x)
				back++;
			if(x < a[i])
				go++;
                }
		if(back < go)
			System.out.println(back);
		else
			System.out.println(go);
        }
} Main public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);

		int n = stdIn.nextInt();
		int m = stdIn.nextInt();
		int x = stdIn.nextInt();
		int back = 0;
		int go = 0;
		int[] a = new int[m];
		int i;
		for(i = 0; i < m; i++){
			a[i] = stdIn.nextInt();
			if(a[i] < x)
				back++;
			if(x < a[i])
				go++;
                }
		if(back < go)
			System.out.println(back);
		else
			System.out.println(go);
        } main {
		Scanner stdIn = new Scanner(System.in);

		int n = stdIn.nextInt();
		int m = stdIn.nextInt();
		int x = stdIn.nextInt();
		int back = 0;
		int go = 0;
		int[] a = new int[m];
		int i;
		for(i = 0; i < m; i++){
			a[i] = stdIn.nextInt();
			if(a[i] < x)
				back++;
			if(x < a[i])
				go++;
                }
		if(back < go)
			System.out.println(back);
		else
			System.out.println(go);
        } Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int n = stdIn.nextInt(); n stdIn.nextInt() stdIn.nextInt stdIn int m = stdIn.nextInt(); m stdIn.nextInt() stdIn.nextInt stdIn int x = stdIn.nextInt(); x stdIn.nextInt() stdIn.nextInt stdIn int back = 0; back 0 int go = 0; go 0 int[] a = new int[m]; a new int[m] m int i; i for(i = 0; i < m; i++){
			a[i] = stdIn.nextInt();
			if(a[i] < x)
				back++;
			if(x < a[i])
				go++;
                } i = 0; i = 0 i 0 i < m i m i++ i++ i {
			a[i] = stdIn.nextInt();
			if(a[i] < x)
				back++;
			if(x < a[i])
				go++;
                } {
			a[i] = stdIn.nextInt();
			if(a[i] < x)
				back++;
			if(x < a[i])
				go++;
                } a[i] = stdIn.nextInt() a[i] a i stdIn.nextInt() stdIn.nextInt stdIn if(a[i] < x)
				back++; a[i] < x a[i] a i x back++ back if(x < a[i])
				go++; x < a[i] x a[i] a i go++ go if(back < go)
			System.out.println(back);
		else
			System.out.println(go); back < go back go System.out.println(back) System.out.println System.out System System.out back System.out.println(go) System.out.println System.out System System.out go String[] args args
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);

		int n = stdIn.nextInt();
		int m = stdIn.nextInt();
		int x = stdIn.nextInt();
		int back = 0;
		int go = 0;
		int[] a = new int[m];
		int i;
		for(i = 0; i < m; i++){
			a[i] = stdIn.nextInt();
			if(a[i] < x)
				back++;
			if(x < a[i])
				go++;
                }
		if(back < go)
			System.out.println(back);
		else
			System.out.println(go);
        }
}