import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		List<Integer> a = new ArrayList<>();
		for(int i=0;i<m;i++) {
			a.add(scan.nextInt());
		}
//System.out.println(a);
		//xからnへ行くとき
		//int[]east =new int[n-x];
		int countEast = 0;
		for(int i=x;i<=n;i++) {
			if(a.contains(i)) {
				countEast++;
			}
		}
//System.out.println(countEast);
		int countWest = 0;
		for(int i=x;i>=0;i--) {
			if(a.contains(i)) {
				countWest++;
			}
		}
		//System.out.println(countWest);
		System.out.println(Math.min(countEast, countWest));
	}

} 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) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		List<Integer> a = new ArrayList<>();
		for(int i=0;i<m;i++) {
			a.add(scan.nextInt());
		}
//System.out.println(a);
		//xからnへ行くとき
		//int[]east =new int[n-x];
		int countEast = 0;
		for(int i=x;i<=n;i++) {
			if(a.contains(i)) {
				countEast++;
			}
		}
//System.out.println(countEast);
		int countWest = 0;
		for(int i=x;i>=0;i--) {
			if(a.contains(i)) {
				countWest++;
			}
		}
		//System.out.println(countWest);
		System.out.println(Math.min(countEast, countWest));
	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		List<Integer> a = new ArrayList<>();
		for(int i=0;i<m;i++) {
			a.add(scan.nextInt());
		}
//System.out.println(a);
		//xからnへ行くとき
		//int[]east =new int[n-x];
		int countEast = 0;
		for(int i=x;i<=n;i++) {
			if(a.contains(i)) {
				countEast++;
			}
		}
//System.out.println(countEast);
		int countWest = 0;
		for(int i=x;i>=0;i--) {
			if(a.contains(i)) {
				countWest++;
			}
		}
		//System.out.println(countWest);
		System.out.println(Math.min(countEast, countWest));
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		List<Integer> a = new ArrayList<>();
		for(int i=0;i<m;i++) {
			a.add(scan.nextInt());
		}
//System.out.println(a);
		//xからnへ行くとき
		//int[]east =new int[n-x];
		int countEast = 0;
		for(int i=x;i<=n;i++) {
			if(a.contains(i)) {
				countEast++;
			}
		}
//System.out.println(countEast);
		int countWest = 0;
		for(int i=x;i>=0;i--) {
			if(a.contains(i)) {
				countWest++;
			}
		}
		//System.out.println(countWest);
		System.out.println(Math.min(countEast, countWest));
	} 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 List<Integer> a = new ArrayList<>(); a new ArrayList<>() for(int i=0;i<m;i++) {
			a.add(scan.nextInt());
		} int i=0; int i=0; i 0 i<m i m i++ i++ i {
			a.add(scan.nextInt());
		} {
			a.add(scan.nextInt());
		} a.add(scan.nextInt()) a.add a scan.nextInt() scan.nextInt scan int countEast = 0; countEast 0 for(int i=x;i<=n;i++) {
			if(a.contains(i)) {
				countEast++;
			}
		} int i=x; int i=x; i x i<=n i n i++ i++ i {
			if(a.contains(i)) {
				countEast++;
			}
		} {
			if(a.contains(i)) {
				countEast++;
			}
		} if(a.contains(i)) {
				countEast++;
			} a.contains(i) a.contains a i {
				countEast++;
			} countEast++ countEast int countWest = 0; countWest 0 for(int i=x;i>=0;i--) {
			if(a.contains(i)) {
				countWest++;
			}
		} int i=x; int i=x; i x i>=0 i 0 i-- i-- i {
			if(a.contains(i)) {
				countWest++;
			}
		} {
			if(a.contains(i)) {
				countWest++;
			}
		} if(a.contains(i)) {
				countWest++;
			} a.contains(i) a.contains a i {
				countWest++;
			} countWest++ countWest System.out.println(Math.min(countEast, countWest)) System.out.println System.out System System.out Math.min(countEast, countWest) Math.min Math countEast countWest String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		List<Integer> a = new ArrayList<>();
		for(int i=0;i<m;i++) {
			a.add(scan.nextInt());
		}
//System.out.println(a);
		//xからnへ行くとき
		//int[]east =new int[n-x];
		int countEast = 0;
		for(int i=x;i<=n;i++) {
			if(a.contains(i)) {
				countEast++;
			}
		}
//System.out.println(countEast);
		int countWest = 0;
		for(int i=x;i>=0;i--) {
			if(a.contains(i)) {
				countWest++;
			}
		}
		//System.out.println(countWest);
		System.out.println(Math.min(countEast, countWest));
	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		List<Integer> a = new ArrayList<>();
		for(int i=0;i<m;i++) {
			a.add(scan.nextInt());
		}
//System.out.println(a);
		//xからnへ行くとき
		//int[]east =new int[n-x];
		int countEast = 0;
		for(int i=x;i<=n;i++) {
			if(a.contains(i)) {
				countEast++;
			}
		}
//System.out.println(countEast);
		int countWest = 0;
		for(int i=x;i>=0;i--) {
			if(a.contains(i)) {
				countWest++;
			}
		}
		//System.out.println(countWest);
		System.out.println(Math.min(countEast, countWest));
	}

} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		List<Integer> a = new ArrayList<>();
		for(int i=0;i<m;i++) {
			a.add(scan.nextInt());
		}
//System.out.println(a);
		//xからnへ行くとき
		//int[]east =new int[n-x];
		int countEast = 0;
		for(int i=x;i<=n;i++) {
			if(a.contains(i)) {
				countEast++;
			}
		}
//System.out.println(countEast);
		int countWest = 0;
		for(int i=x;i>=0;i--) {
			if(a.contains(i)) {
				countWest++;
			}
		}
		//System.out.println(countWest);
		System.out.println(Math.min(countEast, countWest));
	}

}
