import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		int[] a = new int[m];
		int i = 0;
		for(i = 0; i < m; i++) {
			a[i] = scan.nextInt();
		}
		int cost_0 = 0;
		int cost_n = 0;
		int[] s = new int[n + 1];
		for(i = 0; i < n + 1; i++) {
			s[i] = 0;
		}
		for(i = 0; i < m; i++) {
			s[a[i]] = 1;
		}
		for(i = x; i != 0; i--) {
			cost_0 = cost_0 + s[i];
		}
		for(i = x; i != n; i++) {
			cost_n = cost_n + s[i];
		}
		if(cost_0 <= cost_n) {
			System.out.println(cost_0);
		} else {
			System.out.println(cost_n);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		int[] a = new int[m];
		int i = 0;
		for(i = 0; i < m; i++) {
			a[i] = scan.nextInt();
		}
		int cost_0 = 0;
		int cost_n = 0;
		int[] s = new int[n + 1];
		for(i = 0; i < n + 1; i++) {
			s[i] = 0;
		}
		for(i = 0; i < m; i++) {
			s[a[i]] = 1;
		}
		for(i = x; i != 0; i--) {
			cost_0 = cost_0 + s[i];
		}
		for(i = x; i != n; i++) {
			cost_n = cost_n + s[i];
		}
		if(cost_0 <= cost_n) {
			System.out.println(cost_0);
		} else {
			System.out.println(cost_n);
		}
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		int[] a = new int[m];
		int i = 0;
		for(i = 0; i < m; i++) {
			a[i] = scan.nextInt();
		}
		int cost_0 = 0;
		int cost_n = 0;
		int[] s = new int[n + 1];
		for(i = 0; i < n + 1; i++) {
			s[i] = 0;
		}
		for(i = 0; i < m; i++) {
			s[a[i]] = 1;
		}
		for(i = x; i != 0; i--) {
			cost_0 = cost_0 + s[i];
		}
		for(i = x; i != n; i++) {
			cost_n = cost_n + s[i];
		}
		if(cost_0 <= cost_n) {
			System.out.println(cost_0);
		} else {
			System.out.println(cost_n);
		}
	} main {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		int[] a = new int[m];
		int i = 0;
		for(i = 0; i < m; i++) {
			a[i] = scan.nextInt();
		}
		int cost_0 = 0;
		int cost_n = 0;
		int[] s = new int[n + 1];
		for(i = 0; i < n + 1; i++) {
			s[i] = 0;
		}
		for(i = 0; i < m; i++) {
			s[a[i]] = 1;
		}
		for(i = x; i != 0; i--) {
			cost_0 = cost_0 + s[i];
		}
		for(i = x; i != n; i++) {
			cost_n = cost_n + s[i];
		}
		if(cost_0 <= cost_n) {
			System.out.println(cost_0);
		} else {
			System.out.println(cost_n);
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int m = scan.nextInt(); m scan.nextInt() scan.nextInt scan int x = scan.nextInt(); x scan.nextInt() scan.nextInt scan int[] a = new int[m]; a new int[m] m int i = 0; i 0 for(i = 0; i < m; i++) {
			a[i] = scan.nextInt();
		} i = 0; i = 0 i 0 i < m i m i++ i++ i {
			a[i] = scan.nextInt();
		} {
			a[i] = scan.nextInt();
		} a[i] = scan.nextInt() a[i] a i scan.nextInt() scan.nextInt scan int cost_0 = 0; cost_0 0 int cost_n = 0; cost_n 0 int[] s = new int[n + 1]; s new int[n + 1] n + 1 n 1 for(i = 0; i < n + 1; i++) {
			s[i] = 0;
		} i = 0; i = 0 i 0 i < n + 1 i n + 1 n 1 i++ i++ i {
			s[i] = 0;
		} {
			s[i] = 0;
		} s[i] = 0 s[i] s i 0 for(i = 0; i < m; i++) {
			s[a[i]] = 1;
		} i = 0; i = 0 i 0 i < m i m i++ i++ i {
			s[a[i]] = 1;
		} {
			s[a[i]] = 1;
		} s[a[i]] = 1 s[a[i]] s a[i] a i 1 for(i = x; i != 0; i--) {
			cost_0 = cost_0 + s[i];
		} i = x; i = x i x i != 0 i 0 i-- i-- i {
			cost_0 = cost_0 + s[i];
		} {
			cost_0 = cost_0 + s[i];
		} cost_0 = cost_0 + s[i] cost_0 cost_0 + s[i] cost_0 s[i] s i for(i = x; i != n; i++) {
			cost_n = cost_n + s[i];
		} i = x; i = x i x i != n i n i++ i++ i {
			cost_n = cost_n + s[i];
		} {
			cost_n = cost_n + s[i];
		} cost_n = cost_n + s[i] cost_n cost_n + s[i] cost_n s[i] s i if(cost_0 <= cost_n) {
			System.out.println(cost_0);
		} else {
			System.out.println(cost_n);
		} cost_0 <= cost_n cost_0 cost_n {
			System.out.println(cost_0);
		} System.out.println(cost_0) System.out.println System.out System System.out cost_0 {
			System.out.println(cost_n);
		} System.out.println(cost_n) System.out.println System.out System System.out cost_n String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		int[] a = new int[m];
		int i = 0;
		for(i = 0; i < m; i++) {
			a[i] = scan.nextInt();
		}
		int cost_0 = 0;
		int cost_n = 0;
		int[] s = new int[n + 1];
		for(i = 0; i < n + 1; i++) {
			s[i] = 0;
		}
		for(i = 0; i < m; i++) {
			s[a[i]] = 1;
		}
		for(i = x; i != 0; i--) {
			cost_0 = cost_0 + s[i];
		}
		for(i = x; i != n; i++) {
			cost_n = cost_n + s[i];
		}
		if(cost_0 <= cost_n) {
			System.out.println(cost_0);
		} else {
			System.out.println(cost_n);
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		int[] a = new int[m];
		int i = 0;
		for(i = 0; i < m; i++) {
			a[i] = scan.nextInt();
		}
		int cost_0 = 0;
		int cost_n = 0;
		int[] s = new int[n + 1];
		for(i = 0; i < n + 1; i++) {
			s[i] = 0;
		}
		for(i = 0; i < m; i++) {
			s[a[i]] = 1;
		}
		for(i = x; i != 0; i--) {
			cost_0 = cost_0 + s[i];
		}
		for(i = x; i != n; i++) {
			cost_n = cost_n + s[i];
		}
		if(cost_0 <= cost_n) {
			System.out.println(cost_0);
		} else {
			System.out.println(cost_n);
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		int[] a = new int[m];
		int i = 0;
		for(i = 0; i < m; i++) {
			a[i] = scan.nextInt();
		}
		int cost_0 = 0;
		int cost_n = 0;
		int[] s = new int[n + 1];
		for(i = 0; i < n + 1; i++) {
			s[i] = 0;
		}
		for(i = 0; i < m; i++) {
			s[a[i]] = 1;
		}
		for(i = x; i != 0; i--) {
			cost_0 = cost_0 + s[i];
		}
		for(i = x; i != n; i++) {
			cost_n = cost_n + s[i];
		}
		if(cost_0 <= cost_n) {
			System.out.println(cost_0);
		} else {
			System.out.println(cost_n);
		}
	}
}