import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.solveB();
	}

	private void solveB() {
		int min = 0;
		int max = 0;

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		int A[] = new int[M];
		for (int i = 0; i < M; i++) {
			A[i] = sc.nextInt();
		}



		for (int j = 0; j <= M - 1; j++) {
			if (X > A[j]) {
				min = min + 1;
			}
		}
		for (int k = M - 1; k >= 0; k--) {
			if (X < A[k]) {
				max = max + 1;
			}
		}

		if (min > max) {
			System.out.println(max);
		} else if (min < max) {
			System.out.println(min);
		} else {
			System.out.println(min);
		}

		return;
	}

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.solveB();
	}

	private void solveB() {
		int min = 0;
		int max = 0;

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		int A[] = new int[M];
		for (int i = 0; i < M; i++) {
			A[i] = sc.nextInt();
		}



		for (int j = 0; j <= M - 1; j++) {
			if (X > A[j]) {
				min = min + 1;
			}
		}
		for (int k = M - 1; k >= 0; k--) {
			if (X < A[k]) {
				max = max + 1;
			}
		}

		if (min > max) {
			System.out.println(max);
		} else if (min < max) {
			System.out.println(min);
		} else {
			System.out.println(min);
		}

		return;
	}

} Main public static void main(String[] args) {
		Main main = new Main();
		main.solveB();
	} main {
		Main main = new Main();
		main.solveB();
	} Main main = new Main(); main new Main() main.solveB() main.solveB main String[] args args private void solveB() {
		int min = 0;
		int max = 0;

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		int A[] = new int[M];
		for (int i = 0; i < M; i++) {
			A[i] = sc.nextInt();
		}



		for (int j = 0; j <= M - 1; j++) {
			if (X > A[j]) {
				min = min + 1;
			}
		}
		for (int k = M - 1; k >= 0; k--) {
			if (X < A[k]) {
				max = max + 1;
			}
		}

		if (min > max) {
			System.out.println(max);
		} else if (min < max) {
			System.out.println(min);
		} else {
			System.out.println(min);
		}

		return;
	} solveB {
		int min = 0;
		int max = 0;

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		int A[] = new int[M];
		for (int i = 0; i < M; i++) {
			A[i] = sc.nextInt();
		}



		for (int j = 0; j <= M - 1; j++) {
			if (X > A[j]) {
				min = min + 1;
			}
		}
		for (int k = M - 1; k >= 0; k--) {
			if (X < A[k]) {
				max = max + 1;
			}
		}

		if (min > max) {
			System.out.println(max);
		} else if (min < max) {
			System.out.println(min);
		} else {
			System.out.println(min);
		}

		return;
	} int min = 0; min 0 int max = 0; max 0 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 for (int i = 0; i < M; i++) {
			A[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
			A[i] = sc.nextInt();
		} {
			A[i] = sc.nextInt();
		} A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc for (int j = 0; j <= M - 1; j++) {
			if (X > A[j]) {
				min = min + 1;
			}
		} int j = 0; int j = 0; j 0 j <= M - 1 j M - 1 M 1 j++ j++ j {
			if (X > A[j]) {
				min = min + 1;
			}
		} {
			if (X > A[j]) {
				min = min + 1;
			}
		} if (X > A[j]) {
				min = min + 1;
			} X > A[j] X A[j] A j {
				min = min + 1;
			} min = min + 1 min min + 1 min 1 for (int k = M - 1; k >= 0; k--) {
			if (X < A[k]) {
				max = max + 1;
			}
		} int k = M - 1; int k = M - 1; k M - 1 M 1 k >= 0 k 0 k-- k-- k {
			if (X < A[k]) {
				max = max + 1;
			}
		} {
			if (X < A[k]) {
				max = max + 1;
			}
		} if (X < A[k]) {
				max = max + 1;
			} X < A[k] X A[k] A k {
				max = max + 1;
			} max = max + 1 max max + 1 max 1 if (min > max) {
			System.out.println(max);
		} else if (min < max) {
			System.out.println(min);
		} else {
			System.out.println(min);
		} min > max min max {
			System.out.println(max);
		} System.out.println(max) System.out.println System.out System System.out max if (min < max) {
			System.out.println(min);
		} else {
			System.out.println(min);
		} min < max min max {
			System.out.println(min);
		} System.out.println(min) System.out.println System.out System System.out min {
			System.out.println(min);
		} System.out.println(min) System.out.println System.out System System.out min return; public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.solveB();
	}

	private void solveB() {
		int min = 0;
		int max = 0;

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		int A[] = new int[M];
		for (int i = 0; i < M; i++) {
			A[i] = sc.nextInt();
		}



		for (int j = 0; j <= M - 1; j++) {
			if (X > A[j]) {
				min = min + 1;
			}
		}
		for (int k = M - 1; k >= 0; k--) {
			if (X < A[k]) {
				max = max + 1;
			}
		}

		if (min > max) {
			System.out.println(max);
		} else if (min < max) {
			System.out.println(min);
		} else {
			System.out.println(min);
		}

		return;
	}

} public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.solveB();
	}

	private void solveB() {
		int min = 0;
		int max = 0;

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		int A[] = new int[M];
		for (int i = 0; i < M; i++) {
			A[i] = sc.nextInt();
		}



		for (int j = 0; j <= M - 1; j++) {
			if (X > A[j]) {
				min = min + 1;
			}
		}
		for (int k = M - 1; k >= 0; k--) {
			if (X < A[k]) {
				max = max + 1;
			}
		}

		if (min > max) {
			System.out.println(max);
		} else if (min < max) {
			System.out.println(min);
		} else {
			System.out.println(min);
		}

		return;
	}

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.solveB();
	}

	private void solveB() {
		int min = 0;
		int max = 0;

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		int A[] = new int[M];
		for (int i = 0; i < M; i++) {
			A[i] = sc.nextInt();
		}



		for (int j = 0; j <= M - 1; j++) {
			if (X > A[j]) {
				min = min + 1;
			}
		}
		for (int k = M - 1; k >= 0; k--) {
			if (X < A[k]) {
				max = max + 1;
			}
		}

		if (min > max) {
			System.out.println(max);
		} else if (min < max) {
			System.out.println(min);
		} else {
			System.out.println(min);
		}

		return;
	}

}