import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.parseLong;
//import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int m = parseInt(sc.next());
		int x = parseInt(sc.next());
		int[] a = new int[n+1];
		for (i = 0; i < m; i++) {
			a[parseInt(sc.next())] = 1;
		}
		sc.close();
		int cst0 = 0;
		for (i = x-1; i > 0; i--) {
			cst0 += a[i];
		}
		int cstn = 0;
		for (i = x+1; i < n; i++) {
			cstn += a[i];
		}
		out.println(Math.min(cst0, cstn));
	}
} import java.util.*; util.* java import static java.lang.Integer.*; import static java.lang.Integer.*; import static java.lang.Integer.*; import static java.lang.Long.parseLong; import static java.lang.Long.parseLong; import static java.lang.Long.parseLong; import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.System.*; import static java.lang.System.*; import static java.lang.System.*; public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int m = parseInt(sc.next());
		int x = parseInt(sc.next());
		int[] a = new int[n+1];
		for (i = 0; i < m; i++) {
			a[parseInt(sc.next())] = 1;
		}
		sc.close();
		int cst0 = 0;
		for (i = x-1; i > 0; i--) {
			cst0 += a[i];
		}
		int cstn = 0;
		for (i = x+1; i < n; i++) {
			cstn += a[i];
		}
		out.println(Math.min(cst0, cstn));
	}
} Main public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int m = parseInt(sc.next());
		int x = parseInt(sc.next());
		int[] a = new int[n+1];
		for (i = 0; i < m; i++) {
			a[parseInt(sc.next())] = 1;
		}
		sc.close();
		int cst0 = 0;
		for (i = x-1; i > 0; i--) {
			cst0 += a[i];
		}
		int cstn = 0;
		for (i = x+1; i < n; i++) {
			cstn += a[i];
		}
		out.println(Math.min(cst0, cstn));
	} main {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int m = parseInt(sc.next());
		int x = parseInt(sc.next());
		int[] a = new int[n+1];
		for (i = 0; i < m; i++) {
			a[parseInt(sc.next())] = 1;
		}
		sc.close();
		int cst0 = 0;
		for (i = x-1; i > 0; i--) {
			cst0 += a[i];
		}
		int cstn = 0;
		for (i = x+1; i < n; i++) {
			cstn += a[i];
		}
		out.println(Math.min(cst0, cstn));
	} int i i j; j Scanner sc = new Scanner(in); sc new Scanner(in) int n = parseInt(sc.next()); n parseInt(sc.next()) parseInt sc.next() sc.next sc int m = parseInt(sc.next()); m parseInt(sc.next()) parseInt sc.next() sc.next sc int x = parseInt(sc.next()); x parseInt(sc.next()) parseInt sc.next() sc.next sc int[] a = new int[n+1]; a new int[n+1] n+1 n 1 for (i = 0; i < m; i++) {
			a[parseInt(sc.next())] = 1;
		} i = 0; i = 0 i 0 i < m i m i++ i++ i {
			a[parseInt(sc.next())] = 1;
		} {
			a[parseInt(sc.next())] = 1;
		} a[parseInt(sc.next())] = 1 a[parseInt(sc.next())] a parseInt(sc.next()) parseInt sc.next() sc.next sc 1 sc.close() sc.close sc int cst0 = 0; cst0 0 for (i = x-1; i > 0; i--) {
			cst0 += a[i];
		} i = x-1; i = x-1 i x-1 x 1 i > 0 i 0 i-- i-- i {
			cst0 += a[i];
		} {
			cst0 += a[i];
		} cst0 += a[i] cst0 a[i] a i int cstn = 0; cstn 0 for (i = x+1; i < n; i++) {
			cstn += a[i];
		} i = x+1; i = x+1 i x+1 x 1 i < n i n i++ i++ i {
			cstn += a[i];
		} {
			cstn += a[i];
		} cstn += a[i] cstn a[i] a i out.println(Math.min(cst0, cstn)) out.println out Math.min(cst0, cstn) Math.min Math cst0 cstn String[] args args public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int m = parseInt(sc.next());
		int x = parseInt(sc.next());
		int[] a = new int[n+1];
		for (i = 0; i < m; i++) {
			a[parseInt(sc.next())] = 1;
		}
		sc.close();
		int cst0 = 0;
		for (i = x-1; i > 0; i--) {
			cst0 += a[i];
		}
		int cstn = 0;
		for (i = x+1; i < n; i++) {
			cstn += a[i];
		}
		out.println(Math.min(cst0, cstn));
	}
} public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int m = parseInt(sc.next());
		int x = parseInt(sc.next());
		int[] a = new int[n+1];
		for (i = 0; i < m; i++) {
			a[parseInt(sc.next())] = 1;
		}
		sc.close();
		int cst0 = 0;
		for (i = x-1; i > 0; i--) {
			cst0 += a[i];
		}
		int cstn = 0;
		for (i = x+1; i < n; i++) {
			cstn += a[i];
		}
		out.println(Math.min(cst0, cstn));
	}
} Main
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.parseLong;
//import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int m = parseInt(sc.next());
		int x = parseInt(sc.next());
		int[] a = new int[n+1];
		for (i = 0; i < m; i++) {
			a[parseInt(sc.next())] = 1;
		}
		sc.close();
		int cst0 = 0;
		for (i = x-1; i > 0; i--) {
			cst0 += a[i];
		}
		int cstn = 0;
		for (i = x+1; i < n; i++) {
			cstn += a[i];
		}
		out.println(Math.min(cst0, cstn));
	}
}
