import java.util.Scanner;

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 sumRight=0;
		int sumLeft=0;
		int[] marr = new int[101];
		for(int i=0;i<m;i++) {
			marr[sc.nextInt()]=1;
		}
		for(int i=x;i<n;i++) {
			sumRight+=marr[i];
}
		for(int i=x;i>=0;i--) {
			sumLeft+=marr[i];
		}
		
		if(sumRight>sumLeft) System.out.println(sumLeft);
		else System.out.println(sumRight);
	}
} 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();
		int m=sc.nextInt();
		int x=sc.nextInt();
		int sumRight=0;
		int sumLeft=0;
		int[] marr = new int[101];
		for(int i=0;i<m;i++) {
			marr[sc.nextInt()]=1;
		}
		for(int i=x;i<n;i++) {
			sumRight+=marr[i];
}
		for(int i=x;i>=0;i--) {
			sumLeft+=marr[i];
		}
		
		if(sumRight>sumLeft) System.out.println(sumLeft);
		else System.out.println(sumRight);
	}
} 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 sumRight=0;
		int sumLeft=0;
		int[] marr = new int[101];
		for(int i=0;i<m;i++) {
			marr[sc.nextInt()]=1;
		}
		for(int i=x;i<n;i++) {
			sumRight+=marr[i];
}
		for(int i=x;i>=0;i--) {
			sumLeft+=marr[i];
		}
		
		if(sumRight>sumLeft) System.out.println(sumLeft);
		else System.out.println(sumRight);
	} main {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m=sc.nextInt();
		int x=sc.nextInt();
		int sumRight=0;
		int sumLeft=0;
		int[] marr = new int[101];
		for(int i=0;i<m;i++) {
			marr[sc.nextInt()]=1;
		}
		for(int i=x;i<n;i++) {
			sumRight+=marr[i];
}
		for(int i=x;i>=0;i--) {
			sumLeft+=marr[i];
		}
		
		if(sumRight>sumLeft) System.out.println(sumLeft);
		else System.out.println(sumRight);
	} 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 sumRight=0; sumRight 0 int sumLeft=0; sumLeft 0 int[] marr = new int[101]; marr new int[101] 101 for(int i=0;i<m;i++) {
			marr[sc.nextInt()]=1;
		} int i=0; int i=0; i 0 i<m i m i++ i++ i {
			marr[sc.nextInt()]=1;
		} {
			marr[sc.nextInt()]=1;
		} marr[sc.nextInt()]=1 marr[sc.nextInt()] marr sc.nextInt() sc.nextInt sc 1 for(int i=x;i<n;i++) {
			sumRight+=marr[i];
} int i=x; int i=x; i x i<n i n i++ i++ i {
			sumRight+=marr[i];
} {
			sumRight+=marr[i];
} sumRight+=marr[i] sumRight marr[i] marr i for(int i=x;i>=0;i--) {
			sumLeft+=marr[i];
		} int i=x; int i=x; i x i>=0 i 0 i-- i-- i {
			sumLeft+=marr[i];
		} {
			sumLeft+=marr[i];
		} sumLeft+=marr[i] sumLeft marr[i] marr i if(sumRight>sumLeft) System.out.println(sumLeft);
		else System.out.println(sumRight); sumRight>sumLeft sumRight sumLeft System.out.println(sumLeft) System.out.println System.out System System.out sumLeft System.out.println(sumRight) System.out.println System.out System System.out sumRight 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 sumRight=0;
		int sumLeft=0;
		int[] marr = new int[101];
		for(int i=0;i<m;i++) {
			marr[sc.nextInt()]=1;
		}
		for(int i=x;i<n;i++) {
			sumRight+=marr[i];
}
		for(int i=x;i>=0;i--) {
			sumLeft+=marr[i];
		}
		
		if(sumRight>sumLeft) System.out.println(sumLeft);
		else System.out.println(sumRight);
	}
} 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 sumRight=0;
		int sumLeft=0;
		int[] marr = new int[101];
		for(int i=0;i<m;i++) {
			marr[sc.nextInt()]=1;
		}
		for(int i=x;i<n;i++) {
			sumRight+=marr[i];
}
		for(int i=x;i>=0;i--) {
			sumLeft+=marr[i];
		}
		
		if(sumRight>sumLeft) System.out.println(sumLeft);
		else System.out.println(sumRight);
	}
} Main
import java.util.Scanner;

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 sumRight=0;
		int sumLeft=0;
		int[] marr = new int[101];
		for(int i=0;i<m;i++) {
			marr[sc.nextInt()]=1;
		}
		for(int i=x;i<n;i++) {
			sumRight+=marr[i];
}
		for(int i=x;i>=0;i--) {
			sumLeft+=marr[i];
		}
		
		if(sumRight>sumLeft) System.out.println(sumLeft);
		else System.out.println(sumRight);
	}
}
