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 costLeft = 0;
		int costRight = 0;
		for (int i = 0; i < m; i++) {
			int a = sc.nextInt();
			if (a < x) costLeft++;
			if (x < a) costRight++;
		}
		
		System.out.println(Math.min(costLeft, costRight));
		
		sc.close();
	}
}

 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 costLeft = 0;
		int costRight = 0;
		for (int i = 0; i < m; i++) {
			int a = sc.nextInt();
			if (a < x) costLeft++;
			if (x < a) costRight++;
		}
		
		System.out.println(Math.min(costLeft, costRight));
		
		sc.close();
	}
} 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 costLeft = 0;
		int costRight = 0;
		for (int i = 0; i < m; i++) {
			int a = sc.nextInt();
			if (a < x) costLeft++;
			if (x < a) costRight++;
		}
		
		System.out.println(Math.min(costLeft, costRight));
		
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		
		int costLeft = 0;
		int costRight = 0;
		for (int i = 0; i < m; i++) {
			int a = sc.nextInt();
			if (a < x) costLeft++;
			if (x < a) costRight++;
		}
		
		System.out.println(Math.min(costLeft, costRight));
		
		sc.close();
	} 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 costLeft = 0; costLeft 0 int costRight = 0; costRight 0 for (int i = 0; i < m; i++) {
			int a = sc.nextInt();
			if (a < x) costLeft++;
			if (x < a) costRight++;
		} int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
			int a = sc.nextInt();
			if (a < x) costLeft++;
			if (x < a) costRight++;
		} {
			int a = sc.nextInt();
			if (a < x) costLeft++;
			if (x < a) costRight++;
		} int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc if (a < x) costLeft++; a < x a x costLeft++ costLeft if (x < a) costRight++; x < a x a costRight++ costRight System.out.println(Math.min(costLeft, costRight)) System.out.println System.out System System.out Math.min(costLeft, costRight) Math.min Math costLeft costRight sc.close() sc.close sc 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 costLeft = 0;
		int costRight = 0;
		for (int i = 0; i < m; i++) {
			int a = sc.nextInt();
			if (a < x) costLeft++;
			if (x < a) costRight++;
		}
		
		System.out.println(Math.min(costLeft, costRight));
		
		sc.close();
	}
} 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 costLeft = 0;
		int costRight = 0;
		for (int i = 0; i < m; i++) {
			int a = sc.nextInt();
			if (a < x) costLeft++;
			if (x < a) costRight++;
		}
		
		System.out.println(Math.min(costLeft, costRight));
		
		sc.close();
	}
} Main
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 costLeft = 0;
		int costRight = 0;
		for (int i = 0; i < m; i++) {
			int a = sc.nextInt();
			if (a < x) costLeft++;
			if (x < a) costRight++;
		}
		
		System.out.println(Math.min(costLeft, costRight));
		
		sc.close();
	}
}


