import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt();
		boolean[] a = new boolean[n + 1];
		for (int i = 0; i < m; i++)
			a[sc.nextInt()] = true;

		int cost1 = 0, cost2 = 0;
		for (int i = x; i < a.length; i++) {
			if (a[i])
				cost1++;
		}
		for (int i = x; i > 0; i--) {
			if (a[i])
				cost2++;
		}

		System.out.println(Math.min(cost1, cost2));
	}

} 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(), m = sc.nextInt(), x = sc.nextInt();
		boolean[] a = new boolean[n + 1];
		for (int i = 0; i < m; i++)
			a[sc.nextInt()] = true;

		int cost1 = 0, cost2 = 0;
		for (int i = x; i < a.length; i++) {
			if (a[i])
				cost1++;
		}
		for (int i = x; i > 0; i--) {
			if (a[i])
				cost2++;
		}

		System.out.println(Math.min(cost1, cost2));
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt();
		boolean[] a = new boolean[n + 1];
		for (int i = 0; i < m; i++)
			a[sc.nextInt()] = true;

		int cost1 = 0, cost2 = 0;
		for (int i = x; i < a.length; i++) {
			if (a[i])
				cost1++;
		}
		for (int i = x; i > 0; i--) {
			if (a[i])
				cost2++;
		}

		System.out.println(Math.min(cost1, cost2));
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt();
		boolean[] a = new boolean[n + 1];
		for (int i = 0; i < m; i++)
			a[sc.nextInt()] = true;

		int cost1 = 0, cost2 = 0;
		for (int i = x; i < a.length; i++) {
			if (a[i])
				cost1++;
		}
		for (int i = x; i > 0; i--) {
			if (a[i])
				cost2++;
		}

		System.out.println(Math.min(cost1, cost2));
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt() n sc.nextInt() sc.nextInt sc m = sc.nextInt() m sc.nextInt() sc.nextInt sc x = sc.nextInt(); x sc.nextInt() sc.nextInt sc boolean[] a = new boolean[n + 1]; a new boolean[n + 1] n + 1 n 1 for (int i = 0; i < m; i++)
			a[sc.nextInt()] = true; int i = 0; int i = 0; i 0 i < m i m i++ i++ i a[sc.nextInt()] = true; a[sc.nextInt()] = true a[sc.nextInt()] a sc.nextInt() sc.nextInt sc true int cost1 = 0 cost1 0 cost2 = 0; cost2 0 for (int i = x; i < a.length; i++) {
			if (a[i])
				cost1++;
		} int i = x; int i = x; i x i < a.length i a.length a a.length i++ i++ i {
			if (a[i])
				cost1++;
		} {
			if (a[i])
				cost1++;
		} if (a[i])
				cost1++; a[i] a i cost1++ cost1 for (int i = x; i > 0; i--) {
			if (a[i])
				cost2++;
		} int i = x; int i = x; i x i > 0 i 0 i-- i-- i {
			if (a[i])
				cost2++;
		} {
			if (a[i])
				cost2++;
		} if (a[i])
				cost2++; a[i] a i cost2++ cost2 System.out.println(Math.min(cost1, cost2)) System.out.println System.out System System.out Math.min(cost1, cost2) Math.min Math cost1 cost2 String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt();
		boolean[] a = new boolean[n + 1];
		for (int i = 0; i < m; i++)
			a[sc.nextInt()] = true;

		int cost1 = 0, cost2 = 0;
		for (int i = x; i < a.length; i++) {
			if (a[i])
				cost1++;
		}
		for (int i = x; i > 0; i--) {
			if (a[i])
				cost2++;
		}

		System.out.println(Math.min(cost1, cost2));
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt();
		boolean[] a = new boolean[n + 1];
		for (int i = 0; i < m; i++)
			a[sc.nextInt()] = true;

		int cost1 = 0, cost2 = 0;
		for (int i = x; i < a.length; i++) {
			if (a[i])
				cost1++;
		}
		for (int i = x; i > 0; i--) {
			if (a[i])
				cost2++;
		}

		System.out.println(Math.min(cost1, cost2));
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt();
		boolean[] a = new boolean[n + 1];
		for (int i = 0; i < m; i++)
			a[sc.nextInt()] = true;

		int cost1 = 0, cost2 = 0;
		for (int i = x; i < a.length; i++) {
			if (a[i])
				cost1++;
		}
		for (int i = x; i > 0; i--) {
			if (a[i])
				cost2++;
		}

		System.out.println(Math.min(cost1, cost2));
	}

}