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];

		int left = 0;
		int right = 0;
		for (int i = 0; i < m; i++) {
			a[i] = sc.nextInt();
			if (a[i] < x) left++;
			if (x < a[i]) right++;
		}

		if (left < right) {
			System.out.println(left);
		} else {
			System.out.println(right);
		}

		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 a[] = new int[m];

		int left = 0;
		int right = 0;
		for (int i = 0; i < m; i++) {
			a[i] = sc.nextInt();
			if (a[i] < x) left++;
			if (x < a[i]) right++;
		}

		if (left < right) {
			System.out.println(left);
		} else {
			System.out.println(right);
		}

		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 a[] = new int[m];

		int left = 0;
		int right = 0;
		for (int i = 0; i < m; i++) {
			a[i] = sc.nextInt();
			if (a[i] < x) left++;
			if (x < a[i]) right++;
		}

		if (left < right) {
			System.out.println(left);
		} else {
			System.out.println(right);
		}

		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		int a[] = new int[m];

		int left = 0;
		int right = 0;
		for (int i = 0; i < m; i++) {
			a[i] = sc.nextInt();
			if (a[i] < x) left++;
			if (x < a[i]) right++;
		}

		if (left < right) {
			System.out.println(left);
		} else {
			System.out.println(right);
		}

		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 a[] = new int[m]; a new int[m] m int left = 0; left 0 int right = 0; right 0 for (int i = 0; i < m; i++) {
			a[i] = sc.nextInt();
			if (a[i] < x) left++;
			if (x < a[i]) right++;
		} int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
			a[i] = sc.nextInt();
			if (a[i] < x) left++;
			if (x < a[i]) right++;
		} {
			a[i] = sc.nextInt();
			if (a[i] < x) left++;
			if (x < a[i]) right++;
		} a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc if (a[i] < x) left++; a[i] < x a[i] a i x left++ left if (x < a[i]) right++; x < a[i] x a[i] a i right++ right if (left < right) {
			System.out.println(left);
		} else {
			System.out.println(right);
		} left < right left right {
			System.out.println(left);
		} System.out.println(left) System.out.println System.out System System.out left {
			System.out.println(right);
		} System.out.println(right) System.out.println System.out System System.out right 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 a[] = new int[m];

		int left = 0;
		int right = 0;
		for (int i = 0; i < m; i++) {
			a[i] = sc.nextInt();
			if (a[i] < x) left++;
			if (x < a[i]) right++;
		}

		if (left < right) {
			System.out.println(left);
		} else {
			System.out.println(right);
		}

		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 a[] = new int[m];

		int left = 0;
		int right = 0;
		for (int i = 0; i < m; i++) {
			a[i] = sc.nextInt();
			if (a[i] < x) left++;
			if (x < a[i]) right++;
		}

		if (left < right) {
			System.out.println(left);
		} else {
			System.out.println(right);
		}

		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 a[] = new int[m];

		int left = 0;
		int right = 0;
		for (int i = 0; i < m; i++) {
			a[i] = sc.nextInt();
			if (a[i] < x) left++;
			if (x < a[i]) right++;
		}

		if (left < right) {
			System.out.println(left);
		} else {
			System.out.println(right);
		}

		sc.close();
	}

}
