import java.util.Scanner;

class Main{

	static char[][] map;
	//	static int N;
	//	static int M;
	static boolean flag;
	static int ans;



	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[] A = new int[N+1];

		for(int i = 0;i < M;i++){
			A[sc.nextInt()] ++;

		}
		int sub = 0;
		for(int i =X+1;i <= N ;i++){
			if(A[i] > 0){
				sub ++;
			}
		}
		
		int sub2 = 0;
		for(int i =X-1;i>= 0 ;i--){
			if(A[i] > 0){
				sub2 ++;
			}
		}
		System.out.println(Math.min(sub, sub2));


	}


}

class Pair implements Comparable{
	String from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}


 import java.util.Scanner; Scanner java.util class Main{

	static char[][] map;
	//	static int N;
	//	static int M;
	static boolean flag;
	static int ans;



	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[] A = new int[N+1];

		for(int i = 0;i < M;i++){
			A[sc.nextInt()] ++;

		}
		int sub = 0;
		for(int i =X+1;i <= N ;i++){
			if(A[i] > 0){
				sub ++;
			}
		}
		
		int sub2 = 0;
		for(int i =X-1;i>= 0 ;i--){
			if(A[i] > 0){
				sub2 ++;
			}
		}
		System.out.println(Math.min(sub, sub2));


	}


} Main static char[][] map; map //	static int N;
	//	static int M;
	static boolean flag; flag static int ans; ans 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[] A = new int[N+1];

		for(int i = 0;i < M;i++){
			A[sc.nextInt()] ++;

		}
		int sub = 0;
		for(int i =X+1;i <= N ;i++){
			if(A[i] > 0){
				sub ++;
			}
		}
		
		int sub2 = 0;
		for(int i =X-1;i>= 0 ;i--){
			if(A[i] > 0){
				sub2 ++;
			}
		}
		System.out.println(Math.min(sub, sub2));


	} main {



		Scanner sc = new Scanner(System.in);			//文字の入力
		int N =sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		int[] A = new int[N+1];

		for(int i = 0;i < M;i++){
			A[sc.nextInt()] ++;

		}
		int sub = 0;
		for(int i =X+1;i <= N ;i++){
			if(A[i] > 0){
				sub ++;
			}
		}
		
		int sub2 = 0;
		for(int i =X-1;i>= 0 ;i--){
			if(A[i] > 0){
				sub2 ++;
			}
		}
		System.out.println(Math.min(sub, sub2));


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

		} int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
			A[sc.nextInt()] ++;

		} {
			A[sc.nextInt()] ++;

		} A[sc.nextInt()] ++ A[sc.nextInt()] A sc.nextInt() sc.nextInt sc int sub = 0; sub 0 for(int i =X+1;i <= N ;i++){
			if(A[i] > 0){
				sub ++;
			}
		} int i =X+1; int i =X+1; i X+1 X 1 i <= N i N i++ i++ i {
			if(A[i] > 0){
				sub ++;
			}
		} {
			if(A[i] > 0){
				sub ++;
			}
		} if(A[i] > 0){
				sub ++;
			} A[i] > 0 A[i] A i 0 {
				sub ++;
			} sub ++ sub int sub2 = 0; sub2 0 for(int i =X-1;i>= 0 ;i--){
			if(A[i] > 0){
				sub2 ++;
			}
		} int i =X-1; int i =X-1; i X-1 X 1 i>= 0 i 0 i-- i-- i {
			if(A[i] > 0){
				sub2 ++;
			}
		} {
			if(A[i] > 0){
				sub2 ++;
			}
		} if(A[i] > 0){
				sub2 ++;
			} A[i] > 0 A[i] A i 0 {
				sub2 ++;
			} sub2 ++ sub2 System.out.println(Math.min(sub, sub2)) System.out.println System.out System System.out Math.min(sub, sub2) Math.min Math sub sub2 String[] args args class Pair implements Comparable{
	String from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
} Pair String from; from int end; end @Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	} compareTo {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	} Pair otherpair = (Pair)other; otherpair (Pair)other return end - otherpair.end; end - otherpair.end end otherpair.end otherpair otherpair.end Object other other Comparable
import java.util.Scanner;

class Main{

	static char[][] map;
	//	static int N;
	//	static int M;
	static boolean flag;
	static int ans;



	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[] A = new int[N+1];

		for(int i = 0;i < M;i++){
			A[sc.nextInt()] ++;

		}
		int sub = 0;
		for(int i =X+1;i <= N ;i++){
			if(A[i] > 0){
				sub ++;
			}
		}
		
		int sub2 = 0;
		for(int i =X-1;i>= 0 ;i--){
			if(A[i] > 0){
				sub2 ++;
			}
		}
		System.out.println(Math.min(sub, sub2));


	}


}

class Pair implements Comparable{
	String from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}



