import 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 arr[] = new int[m];
		for(int i = 0;i<arr.length;i++){
			arr[i] = sc.nextInt();
		}

		int flag[] = new int[n];
		for(int i= 0;i<flag.length;i++){
			flag[i] = 0;
		}
		
		for(int i= 0;i<flag.length;i++){
			for(int j= 0;j<arr.length;j++){
				if(arr[j] == i){
					flag[i] = 1;
				}
			}
		}
		int leftResult =0;
		int rightResult =0;
		for(int i=x;i>=0;i--){
			leftResult = leftResult + flag[i];
		}
		for(int i=x+1;i<n;i++){
			rightResult = rightResult + flag[i];
		}
		if(leftResult < rightResult){
			System.out.println(leftResult);
		} else{
			System.out.println(rightResult);
		}
		
	}
} import java.util.*; util.* java 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 arr[] = new int[m];
		for(int i = 0;i<arr.length;i++){
			arr[i] = sc.nextInt();
		}

		int flag[] = new int[n];
		for(int i= 0;i<flag.length;i++){
			flag[i] = 0;
		}
		
		for(int i= 0;i<flag.length;i++){
			for(int j= 0;j<arr.length;j++){
				if(arr[j] == i){
					flag[i] = 1;
				}
			}
		}
		int leftResult =0;
		int rightResult =0;
		for(int i=x;i>=0;i--){
			leftResult = leftResult + flag[i];
		}
		for(int i=x+1;i<n;i++){
			rightResult = rightResult + flag[i];
		}
		if(leftResult < rightResult){
			System.out.println(leftResult);
		} else{
			System.out.println(rightResult);
		}
		
	}
} 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 arr[] = new int[m];
		for(int i = 0;i<arr.length;i++){
			arr[i] = sc.nextInt();
		}

		int flag[] = new int[n];
		for(int i= 0;i<flag.length;i++){
			flag[i] = 0;
		}
		
		for(int i= 0;i<flag.length;i++){
			for(int j= 0;j<arr.length;j++){
				if(arr[j] == i){
					flag[i] = 1;
				}
			}
		}
		int leftResult =0;
		int rightResult =0;
		for(int i=x;i>=0;i--){
			leftResult = leftResult + flag[i];
		}
		for(int i=x+1;i<n;i++){
			rightResult = rightResult + flag[i];
		}
		if(leftResult < rightResult){
			System.out.println(leftResult);
		} else{
			System.out.println(rightResult);
		}
		
	} main {
		Scanner sc = new Scanner(System.in);
		//总数
		int n = sc.nextInt();
		//数组长度
		int m = sc.nextInt();
		//初始位置
		int x = sc.nextInt();
		int arr[] = new int[m];
		for(int i = 0;i<arr.length;i++){
			arr[i] = sc.nextInt();
		}

		int flag[] = new int[n];
		for(int i= 0;i<flag.length;i++){
			flag[i] = 0;
		}
		
		for(int i= 0;i<flag.length;i++){
			for(int j= 0;j<arr.length;j++){
				if(arr[j] == i){
					flag[i] = 1;
				}
			}
		}
		int leftResult =0;
		int rightResult =0;
		for(int i=x;i>=0;i--){
			leftResult = leftResult + flag[i];
		}
		for(int i=x+1;i<n;i++){
			rightResult = rightResult + flag[i];
		}
		if(leftResult < rightResult){
			System.out.println(leftResult);
		} else{
			System.out.println(rightResult);
		}
		
	} 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 arr[] = new int[m]; arr new int[m] m for(int i = 0;i<arr.length;i++){
			arr[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i<arr.length i arr.length arr arr.length i++ i++ i {
			arr[i] = sc.nextInt();
		} {
			arr[i] = sc.nextInt();
		} arr[i] = sc.nextInt() arr[i] arr i sc.nextInt() sc.nextInt sc int flag[] = new int[n]; flag new int[n] n for(int i= 0;i<flag.length;i++){
			flag[i] = 0;
		} int i= 0; int i= 0; i 0 i<flag.length i flag.length flag flag.length i++ i++ i {
			flag[i] = 0;
		} {
			flag[i] = 0;
		} flag[i] = 0 flag[i] flag i 0 for(int i= 0;i<flag.length;i++){
			for(int j= 0;j<arr.length;j++){
				if(arr[j] == i){
					flag[i] = 1;
				}
			}
		} int i= 0; int i= 0; i 0 i<flag.length i flag.length flag flag.length i++ i++ i {
			for(int j= 0;j<arr.length;j++){
				if(arr[j] == i){
					flag[i] = 1;
				}
			}
		} {
			for(int j= 0;j<arr.length;j++){
				if(arr[j] == i){
					flag[i] = 1;
				}
			}
		} for(int j= 0;j<arr.length;j++){
				if(arr[j] == i){
					flag[i] = 1;
				}
			} int j= 0; int j= 0; j 0 j<arr.length j arr.length arr arr.length j++ j++ j {
				if(arr[j] == i){
					flag[i] = 1;
				}
			} {
				if(arr[j] == i){
					flag[i] = 1;
				}
			} if(arr[j] == i){
					flag[i] = 1;
				} arr[j] == i arr[j] arr j i {
					flag[i] = 1;
				} flag[i] = 1 flag[i] flag i 1 int leftResult =0; leftResult 0 int rightResult =0; rightResult 0 for(int i=x;i>=0;i--){
			leftResult = leftResult + flag[i];
		} int i=x; int i=x; i x i>=0 i 0 i-- i-- i {
			leftResult = leftResult + flag[i];
		} {
			leftResult = leftResult + flag[i];
		} leftResult = leftResult + flag[i] leftResult leftResult + flag[i] leftResult flag[i] flag i for(int i=x+1;i<n;i++){
			rightResult = rightResult + flag[i];
		} int i=x+1; int i=x+1; i x+1 x 1 i<n i n i++ i++ i {
			rightResult = rightResult + flag[i];
		} {
			rightResult = rightResult + flag[i];
		} rightResult = rightResult + flag[i] rightResult rightResult + flag[i] rightResult flag[i] flag i if(leftResult < rightResult){
			System.out.println(leftResult);
		} else{
			System.out.println(rightResult);
		} leftResult < rightResult leftResult rightResult {
			System.out.println(leftResult);
		} System.out.println(leftResult) System.out.println System.out System System.out leftResult {
			System.out.println(rightResult);
		} System.out.println(rightResult) System.out.println System.out System System.out rightResult 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 arr[] = new int[m];
		for(int i = 0;i<arr.length;i++){
			arr[i] = sc.nextInt();
		}

		int flag[] = new int[n];
		for(int i= 0;i<flag.length;i++){
			flag[i] = 0;
		}
		
		for(int i= 0;i<flag.length;i++){
			for(int j= 0;j<arr.length;j++){
				if(arr[j] == i){
					flag[i] = 1;
				}
			}
		}
		int leftResult =0;
		int rightResult =0;
		for(int i=x;i>=0;i--){
			leftResult = leftResult + flag[i];
		}
		for(int i=x+1;i<n;i++){
			rightResult = rightResult + flag[i];
		}
		if(leftResult < rightResult){
			System.out.println(leftResult);
		} else{
			System.out.println(rightResult);
		}
		
	}
} 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 arr[] = new int[m];
		for(int i = 0;i<arr.length;i++){
			arr[i] = sc.nextInt();
		}

		int flag[] = new int[n];
		for(int i= 0;i<flag.length;i++){
			flag[i] = 0;
		}
		
		for(int i= 0;i<flag.length;i++){
			for(int j= 0;j<arr.length;j++){
				if(arr[j] == i){
					flag[i] = 1;
				}
			}
		}
		int leftResult =0;
		int rightResult =0;
		for(int i=x;i>=0;i--){
			leftResult = leftResult + flag[i];
		}
		for(int i=x+1;i<n;i++){
			rightResult = rightResult + flag[i];
		}
		if(leftResult < rightResult){
			System.out.println(leftResult);
		} else{
			System.out.println(rightResult);
		}
		
	}
} Main
import 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 arr[] = new int[m];
		for(int i = 0;i<arr.length;i++){
			arr[i] = sc.nextInt();
		}

		int flag[] = new int[n];
		for(int i= 0;i<flag.length;i++){
			flag[i] = 0;
		}
		
		for(int i= 0;i<flag.length;i++){
			for(int j= 0;j<arr.length;j++){
				if(arr[j] == i){
					flag[i] = 1;
				}
			}
		}
		int leftResult =0;
		int rightResult =0;
		for(int i=x;i>=0;i--){
			leftResult = leftResult + flag[i];
		}
		for(int i=x+1;i<n;i++){
			rightResult = rightResult + flag[i];
		}
		if(leftResult < rightResult){
			System.out.println(leftResult);
		} else{
			System.out.println(rightResult);
		}
		
	}
}
