import java.util.ArrayList;
import java.util.List;
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();
		List<Integer> a = new ArrayList<>();
		for(int i=0; i<m; i++) {
			a.add(sc.nextInt());
		}
		int cost1=0,cost2=0;
		for(int i=x; i<n; i++) {
			if(a.indexOf(i) != -1) cost1++;
		}
		for(int i=x; i>0; i--) {
			if(a.indexOf(i) != -1) cost2++;
		}
		System.out.println(cost1 < cost2 ? cost1:cost2);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util 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();
		List<Integer> a = new ArrayList<>();
		for(int i=0; i<m; i++) {
			a.add(sc.nextInt());
		}
		int cost1=0,cost2=0;
		for(int i=x; i<n; i++) {
			if(a.indexOf(i) != -1) cost1++;
		}
		for(int i=x; i>0; i--) {
			if(a.indexOf(i) != -1) cost2++;
		}
		System.out.println(cost1 < cost2 ? 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();
		List<Integer> a = new ArrayList<>();
		for(int i=0; i<m; i++) {
			a.add(sc.nextInt());
		}
		int cost1=0,cost2=0;
		for(int i=x; i<n; i++) {
			if(a.indexOf(i) != -1) cost1++;
		}
		for(int i=x; i>0; i--) {
			if(a.indexOf(i) != -1) cost2++;
		}
		System.out.println(cost1 < cost2 ? cost1:cost2);
	} main {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt(),m=sc.nextInt(),x=sc.nextInt();
		List<Integer> a = new ArrayList<>();
		for(int i=0; i<m; i++) {
			a.add(sc.nextInt());
		}
		int cost1=0,cost2=0;
		for(int i=x; i<n; i++) {
			if(a.indexOf(i) != -1) cost1++;
		}
		for(int i=x; i>0; i--) {
			if(a.indexOf(i) != -1) cost2++;
		}
		System.out.println(cost1 < cost2 ? 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 List<Integer> a = new ArrayList<>(); a new ArrayList<>() for(int i=0; i<m; i++) {
			a.add(sc.nextInt());
		} int i=0; int i=0; i 0 i<m i m i++ i++ i {
			a.add(sc.nextInt());
		} {
			a.add(sc.nextInt());
		} a.add(sc.nextInt()) a.add a sc.nextInt() sc.nextInt sc int cost1=0 cost1 0 cost2=0; cost2 0 for(int i=x; i<n; i++) {
			if(a.indexOf(i) != -1) cost1++;
		} int i=x; int i=x; i x i<n i n i++ i++ i {
			if(a.indexOf(i) != -1) cost1++;
		} {
			if(a.indexOf(i) != -1) cost1++;
		} if(a.indexOf(i) != -1) cost1++; a.indexOf(i) != -1 a.indexOf(i) a.indexOf a i -1 1 cost1++ cost1 for(int i=x; i>0; i--) {
			if(a.indexOf(i) != -1) cost2++;
		} int i=x; int i=x; i x i>0 i 0 i-- i-- i {
			if(a.indexOf(i) != -1) cost2++;
		} {
			if(a.indexOf(i) != -1) cost2++;
		} if(a.indexOf(i) != -1) cost2++; a.indexOf(i) != -1 a.indexOf(i) a.indexOf a i -1 1 cost2++ cost2 System.out.println(cost1 < cost2 ? cost1:cost2) System.out.println System.out System System.out cost1 < cost2 ? cost1:cost2 cost1 < cost2 cost1 cost2 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();
		List<Integer> a = new ArrayList<>();
		for(int i=0; i<m; i++) {
			a.add(sc.nextInt());
		}
		int cost1=0,cost2=0;
		for(int i=x; i<n; i++) {
			if(a.indexOf(i) != -1) cost1++;
		}
		for(int i=x; i>0; i--) {
			if(a.indexOf(i) != -1) cost2++;
		}
		System.out.println(cost1 < cost2 ? 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();
		List<Integer> a = new ArrayList<>();
		for(int i=0; i<m; i++) {
			a.add(sc.nextInt());
		}
		int cost1=0,cost2=0;
		for(int i=x; i<n; i++) {
			if(a.indexOf(i) != -1) cost1++;
		}
		for(int i=x; i>0; i--) {
			if(a.indexOf(i) != -1) cost2++;
		}
		System.out.println(cost1 < cost2 ? cost1:cost2);
	}
} Main
import java.util.ArrayList;
import java.util.List;
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();
		List<Integer> a = new ArrayList<>();
		for(int i=0; i<m; i++) {
			a.add(sc.nextInt());
		}
		int cost1=0,cost2=0;
		for(int i=x; i<n; i++) {
			if(a.indexOf(i) != -1) cost1++;
		}
		for(int i=x; i>0; i--) {
			if(a.indexOf(i) != -1) cost2++;
		}
		System.out.println(cost1 < cost2 ? cost1:cost2);
	}
}
