

import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int n = scanner.nextInt()+1;
		int m = scanner.nextInt();
		int x = scanner.nextInt();
		
		boolean[] gate = new boolean[n];
		Arrays.fill(gate, false);
		
		for (int i = 0; i < m; i++) {
			int g = scanner.nextInt();
			gate[g] = true;
		}
		
		int rgoal = 0;
		int lgoal = 0;
		
		
		for (int i = x; i < gate.length; i++) {
			if (gate[i]) {
				rgoal++;
			}
		}
		
		for (int i = x; i > 0; i--) {
			if (gate[i]) {
				lgoal++;
			}
		}
		
		int anser = lgoal;
		
		if (rgoal<lgoal) {
			anser = rgoal;
		}
		
		System.out.println(anser);
		scanner.close();
	}
	
	

} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int n = scanner.nextInt()+1;
		int m = scanner.nextInt();
		int x = scanner.nextInt();
		
		boolean[] gate = new boolean[n];
		Arrays.fill(gate, false);
		
		for (int i = 0; i < m; i++) {
			int g = scanner.nextInt();
			gate[g] = true;
		}
		
		int rgoal = 0;
		int lgoal = 0;
		
		
		for (int i = x; i < gate.length; i++) {
			if (gate[i]) {
				rgoal++;
			}
		}
		
		for (int i = x; i > 0; i--) {
			if (gate[i]) {
				lgoal++;
			}
		}
		
		int anser = lgoal;
		
		if (rgoal<lgoal) {
			anser = rgoal;
		}
		
		System.out.println(anser);
		scanner.close();
	}
	
	

} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int n = scanner.nextInt()+1;
		int m = scanner.nextInt();
		int x = scanner.nextInt();
		
		boolean[] gate = new boolean[n];
		Arrays.fill(gate, false);
		
		for (int i = 0; i < m; i++) {
			int g = scanner.nextInt();
			gate[g] = true;
		}
		
		int rgoal = 0;
		int lgoal = 0;
		
		
		for (int i = x; i < gate.length; i++) {
			if (gate[i]) {
				rgoal++;
			}
		}
		
		for (int i = x; i > 0; i--) {
			if (gate[i]) {
				lgoal++;
			}
		}
		
		int anser = lgoal;
		
		if (rgoal<lgoal) {
			anser = rgoal;
		}
		
		System.out.println(anser);
		scanner.close();
	} main {
		Scanner scanner = new Scanner(System.in);
		
		int n = scanner.nextInt()+1;
		int m = scanner.nextInt();
		int x = scanner.nextInt();
		
		boolean[] gate = new boolean[n];
		Arrays.fill(gate, false);
		
		for (int i = 0; i < m; i++) {
			int g = scanner.nextInt();
			gate[g] = true;
		}
		
		int rgoal = 0;
		int lgoal = 0;
		
		
		for (int i = x; i < gate.length; i++) {
			if (gate[i]) {
				rgoal++;
			}
		}
		
		for (int i = x; i > 0; i--) {
			if (gate[i]) {
				lgoal++;
			}
		}
		
		int anser = lgoal;
		
		if (rgoal<lgoal) {
			anser = rgoal;
		}
		
		System.out.println(anser);
		scanner.close();
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt()+1; n scanner.nextInt()+1 scanner.nextInt() scanner.nextInt scanner 1 int m = scanner.nextInt(); m scanner.nextInt() scanner.nextInt scanner int x = scanner.nextInt(); x scanner.nextInt() scanner.nextInt scanner boolean[] gate = new boolean[n]; gate new boolean[n] n Arrays.fill(gate, false) Arrays.fill Arrays gate false for (int i = 0; i < m; i++) {
			int g = scanner.nextInt();
			gate[g] = true;
		} int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
			int g = scanner.nextInt();
			gate[g] = true;
		} {
			int g = scanner.nextInt();
			gate[g] = true;
		} int g = scanner.nextInt(); g scanner.nextInt() scanner.nextInt scanner gate[g] = true gate[g] gate g true int rgoal = 0; rgoal 0 int lgoal = 0; lgoal 0 for (int i = x; i < gate.length; i++) {
			if (gate[i]) {
				rgoal++;
			}
		} int i = x; int i = x; i x i < gate.length i gate.length gate gate.length i++ i++ i {
			if (gate[i]) {
				rgoal++;
			}
		} {
			if (gate[i]) {
				rgoal++;
			}
		} if (gate[i]) {
				rgoal++;
			} gate[i] gate i {
				rgoal++;
			} rgoal++ rgoal for (int i = x; i > 0; i--) {
			if (gate[i]) {
				lgoal++;
			}
		} int i = x; int i = x; i x i > 0 i 0 i-- i-- i {
			if (gate[i]) {
				lgoal++;
			}
		} {
			if (gate[i]) {
				lgoal++;
			}
		} if (gate[i]) {
				lgoal++;
			} gate[i] gate i {
				lgoal++;
			} lgoal++ lgoal int anser = lgoal; anser lgoal if (rgoal<lgoal) {
			anser = rgoal;
		} rgoal<lgoal rgoal lgoal {
			anser = rgoal;
		} anser = rgoal anser rgoal System.out.println(anser) System.out.println System.out System System.out anser scanner.close() scanner.close scanner String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int n = scanner.nextInt()+1;
		int m = scanner.nextInt();
		int x = scanner.nextInt();
		
		boolean[] gate = new boolean[n];
		Arrays.fill(gate, false);
		
		for (int i = 0; i < m; i++) {
			int g = scanner.nextInt();
			gate[g] = true;
		}
		
		int rgoal = 0;
		int lgoal = 0;
		
		
		for (int i = x; i < gate.length; i++) {
			if (gate[i]) {
				rgoal++;
			}
		}
		
		for (int i = x; i > 0; i--) {
			if (gate[i]) {
				lgoal++;
			}
		}
		
		int anser = lgoal;
		
		if (rgoal<lgoal) {
			anser = rgoal;
		}
		
		System.out.println(anser);
		scanner.close();
	}
	
	

} public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int n = scanner.nextInt()+1;
		int m = scanner.nextInt();
		int x = scanner.nextInt();
		
		boolean[] gate = new boolean[n];
		Arrays.fill(gate, false);
		
		for (int i = 0; i < m; i++) {
			int g = scanner.nextInt();
			gate[g] = true;
		}
		
		int rgoal = 0;
		int lgoal = 0;
		
		
		for (int i = x; i < gate.length; i++) {
			if (gate[i]) {
				rgoal++;
			}
		}
		
		for (int i = x; i > 0; i--) {
			if (gate[i]) {
				lgoal++;
			}
		}
		
		int anser = lgoal;
		
		if (rgoal<lgoal) {
			anser = rgoal;
		}
		
		System.out.println(anser);
		scanner.close();
	}
	
	

} Main


import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int n = scanner.nextInt()+1;
		int m = scanner.nextInt();
		int x = scanner.nextInt();
		
		boolean[] gate = new boolean[n];
		Arrays.fill(gate, false);
		
		for (int i = 0; i < m; i++) {
			int g = scanner.nextInt();
			gate[g] = true;
		}
		
		int rgoal = 0;
		int lgoal = 0;
		
		
		for (int i = x; i < gate.length; i++) {
			if (gate[i]) {
				rgoal++;
			}
		}
		
		for (int i = x; i > 0; i--) {
			if (gate[i]) {
				lgoal++;
			}
		}
		
		int anser = lgoal;
		
		if (rgoal<lgoal) {
			anser = rgoal;
		}
		
		System.out.println(anser);
		scanner.close();
	}
	
	

}
