import 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[] math = new int[N + 1];
		for (int i = 0; i < M; i++) {
			int x = sc.nextInt();
			math[x]++;
		}
		int route1 = 0;
		int route2 = 0;
		for (int i = (X + 1); i <= N; i++) {
			route1 += math[i];
		}
		for (int i = (X - 1); i >= 0; i--) {
			route2 += math[i];
		}

		if (route1 <= route2) {
			System.out.println(route1);
		} else {
			System.out.println(route2);
		}

		sc.close();

	}

} import java.util.*; util.* java 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[] math = new int[N + 1];
		for (int i = 0; i < M; i++) {
			int x = sc.nextInt();
			math[x]++;
		}
		int route1 = 0;
		int route2 = 0;
		for (int i = (X + 1); i <= N; i++) {
			route1 += math[i];
		}
		for (int i = (X - 1); i >= 0; i--) {
			route2 += math[i];
		}

		if (route1 <= route2) {
			System.out.println(route1);
		} else {
			System.out.println(route2);
		}

		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[] math = new int[N + 1];
		for (int i = 0; i < M; i++) {
			int x = sc.nextInt();
			math[x]++;
		}
		int route1 = 0;
		int route2 = 0;
		for (int i = (X + 1); i <= N; i++) {
			route1 += math[i];
		}
		for (int i = (X - 1); i >= 0; i--) {
			route2 += math[i];
		}

		if (route1 <= route2) {
			System.out.println(route1);
		} else {
			System.out.println(route2);
		}

		sc.close();

	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		int[] math = new int[N + 1];
		for (int i = 0; i < M; i++) {
			int x = sc.nextInt();
			math[x]++;
		}
		int route1 = 0;
		int route2 = 0;
		for (int i = (X + 1); i <= N; i++) {
			route1 += math[i];
		}
		for (int i = (X - 1); i >= 0; i--) {
			route2 += math[i];
		}

		if (route1 <= route2) {
			System.out.println(route1);
		} else {
			System.out.println(route2);
		}

		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[] math = new int[N + 1]; math new int[N + 1] N + 1 N 1 for (int i = 0; i < M; i++) {
			int x = sc.nextInt();
			math[x]++;
		} int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
			int x = sc.nextInt();
			math[x]++;
		} {
			int x = sc.nextInt();
			math[x]++;
		} int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc math[x]++ math[x] math x int route1 = 0; route1 0 int route2 = 0; route2 0 for (int i = (X + 1); i <= N; i++) {
			route1 += math[i];
		} int i = (X + 1); int i = (X + 1); i (X + 1) X 1 i <= N i N i++ i++ i {
			route1 += math[i];
		} {
			route1 += math[i];
		} route1 += math[i] route1 math[i] math i for (int i = (X - 1); i >= 0; i--) {
			route2 += math[i];
		} int i = (X - 1); int i = (X - 1); i (X - 1) X 1 i >= 0 i 0 i-- i-- i {
			route2 += math[i];
		} {
			route2 += math[i];
		} route2 += math[i] route2 math[i] math i if (route1 <= route2) {
			System.out.println(route1);
		} else {
			System.out.println(route2);
		} route1 <= route2 route1 route2 {
			System.out.println(route1);
		} System.out.println(route1) System.out.println System.out System System.out route1 {
			System.out.println(route2);
		} System.out.println(route2) System.out.println System.out System System.out route2 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[] math = new int[N + 1];
		for (int i = 0; i < M; i++) {
			int x = sc.nextInt();
			math[x]++;
		}
		int route1 = 0;
		int route2 = 0;
		for (int i = (X + 1); i <= N; i++) {
			route1 += math[i];
		}
		for (int i = (X - 1); i >= 0; i--) {
			route2 += math[i];
		}

		if (route1 <= route2) {
			System.out.println(route1);
		} else {
			System.out.println(route2);
		}

		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[] math = new int[N + 1];
		for (int i = 0; i < M; i++) {
			int x = sc.nextInt();
			math[x]++;
		}
		int route1 = 0;
		int route2 = 0;
		for (int i = (X + 1); i <= N; i++) {
			route1 += math[i];
		}
		for (int i = (X - 1); i >= 0; i--) {
			route2 += math[i];
		}

		if (route1 <= route2) {
			System.out.println(route1);
		} else {
			System.out.println(route2);
		}

		sc.close();

	}

} Main
import 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[] math = new int[N + 1];
		for (int i = 0; i < M; i++) {
			int x = sc.nextInt();
			math[x]++;
		}
		int route1 = 0;
		int route2 = 0;
		for (int i = (X + 1); i <= N; i++) {
			route1 += math[i];
		}
		for (int i = (X - 1); i >= 0; i--) {
			route2 += math[i];
		}

		if (route1 <= route2) {
			System.out.println(route1);
		} else {
			System.out.println(route2);
		}

		sc.close();

	}

}