import java.util.Scanner;

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

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		int[] place=new int[m];
		for(int i=0;i<m;i++){
			place[i]=scan.nextInt();
		}
		int num1=0;
		for(int i=0;i<m;i++){
			if(place[i]<x){
				num1++;
			}
		}
		int num2=0;
		for(int i=0;i<m;i++){
			if(place[i]>x){
				num2++;
			}
		}
		if(num1<num2){
			System.out.println(num1);
		} else {
			System.out.println(num2);
		}
	}
}
