import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//マスの数(N+1)
		int N = sc.nextInt();
		//コストのかかるマスの数
		int M = sc.nextInt();
		//初期位置
		int X = sc.nextInt();

		int[] costMasu = new int[M];

		for(int i = 0; i < M; i++){
		    costMasu[i] = sc.nextInt();
		}

		int cost2N = 0;
		int cost20 = 0;

		for(int j = X; j <= N; j++){
		    for(int k = 0; k < M; k++){
			if(costMasu[k] == j){
			    cost2N++;
			}
		    }
		}

		for(int l = X; l > 0; l--){
		    for(int m = 0; m < M; m++){
			if(costMasu[m] == l){
			    cost20++;
			}
		    }
		}

		if(cost2N <= cost20){
		    System.out.println(cost2N);
		}else{
		    System.out.println(cost20);
		}
	}
} import java.util.*; util.* java public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//マスの数(N+1)
		int N = sc.nextInt();
		//コストのかかるマスの数
		int M = sc.nextInt();
		//初期位置
		int X = sc.nextInt();

		int[] costMasu = new int[M];

		for(int i = 0; i < M; i++){
		    costMasu[i] = sc.nextInt();
		}

		int cost2N = 0;
		int cost20 = 0;

		for(int j = X; j <= N; j++){
		    for(int k = 0; k < M; k++){
			if(costMasu[k] == j){
			    cost2N++;
			}
		    }
		}

		for(int l = X; l > 0; l--){
		    for(int m = 0; m < M; m++){
			if(costMasu[m] == l){
			    cost20++;
			}
		    }
		}

		if(cost2N <= cost20){
		    System.out.println(cost2N);
		}else{
		    System.out.println(cost20);
		}
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//マスの数(N+1)
		int N = sc.nextInt();
		//コストのかかるマスの数
		int M = sc.nextInt();
		//初期位置
		int X = sc.nextInt();

		int[] costMasu = new int[M];

		for(int i = 0; i < M; i++){
		    costMasu[i] = sc.nextInt();
		}

		int cost2N = 0;
		int cost20 = 0;

		for(int j = X; j <= N; j++){
		    for(int k = 0; k < M; k++){
			if(costMasu[k] == j){
			    cost2N++;
			}
		    }
		}

		for(int l = X; l > 0; l--){
		    for(int m = 0; m < M; m++){
			if(costMasu[m] == l){
			    cost20++;
			}
		    }
		}

		if(cost2N <= cost20){
		    System.out.println(cost2N);
		}else{
		    System.out.println(cost20);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		//マスの数(N+1)
		int N = sc.nextInt();
		//コストのかかるマスの数
		int M = sc.nextInt();
		//初期位置
		int X = sc.nextInt();

		int[] costMasu = new int[M];

		for(int i = 0; i < M; i++){
		    costMasu[i] = sc.nextInt();
		}

		int cost2N = 0;
		int cost20 = 0;

		for(int j = X; j <= N; j++){
		    for(int k = 0; k < M; k++){
			if(costMasu[k] == j){
			    cost2N++;
			}
		    }
		}

		for(int l = X; l > 0; l--){
		    for(int m = 0; m < M; m++){
			if(costMasu[m] == l){
			    cost20++;
			}
		    }
		}

		if(cost2N <= cost20){
		    System.out.println(cost2N);
		}else{
		    System.out.println(cost20);
		}
	} 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[] costMasu = new int[M]; costMasu new int[M] M for(int i = 0; i < M; i++){
		    costMasu[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
		    costMasu[i] = sc.nextInt();
		} {
		    costMasu[i] = sc.nextInt();
		} costMasu[i] = sc.nextInt() costMasu[i] costMasu i sc.nextInt() sc.nextInt sc int cost2N = 0; cost2N 0 int cost20 = 0; cost20 0 for(int j = X; j <= N; j++){
		    for(int k = 0; k < M; k++){
			if(costMasu[k] == j){
			    cost2N++;
			}
		    }
		} int j = X; int j = X; j X j <= N j N j++ j++ j {
		    for(int k = 0; k < M; k++){
			if(costMasu[k] == j){
			    cost2N++;
			}
		    }
		} {
		    for(int k = 0; k < M; k++){
			if(costMasu[k] == j){
			    cost2N++;
			}
		    }
		} for(int k = 0; k < M; k++){
			if(costMasu[k] == j){
			    cost2N++;
			}
		    } int k = 0; int k = 0; k 0 k < M k M k++ k++ k {
			if(costMasu[k] == j){
			    cost2N++;
			}
		    } {
			if(costMasu[k] == j){
			    cost2N++;
			}
		    } if(costMasu[k] == j){
			    cost2N++;
			} costMasu[k] == j costMasu[k] costMasu k j {
			    cost2N++;
			} cost2N++ cost2N for(int l = X; l > 0; l--){
		    for(int m = 0; m < M; m++){
			if(costMasu[m] == l){
			    cost20++;
			}
		    }
		} int l = X; int l = X; l X l > 0 l 0 l-- l-- l {
		    for(int m = 0; m < M; m++){
			if(costMasu[m] == l){
			    cost20++;
			}
		    }
		} {
		    for(int m = 0; m < M; m++){
			if(costMasu[m] == l){
			    cost20++;
			}
		    }
		} for(int m = 0; m < M; m++){
			if(costMasu[m] == l){
			    cost20++;
			}
		    } int m = 0; int m = 0; m 0 m < M m M m++ m++ m {
			if(costMasu[m] == l){
			    cost20++;
			}
		    } {
			if(costMasu[m] == l){
			    cost20++;
			}
		    } if(costMasu[m] == l){
			    cost20++;
			} costMasu[m] == l costMasu[m] costMasu m l {
			    cost20++;
			} cost20++ cost20 if(cost2N <= cost20){
		    System.out.println(cost2N);
		}else{
		    System.out.println(cost20);
		} cost2N <= cost20 cost2N cost20 {
		    System.out.println(cost2N);
		} System.out.println(cost2N) System.out.println System.out System System.out cost2N {
		    System.out.println(cost20);
		} System.out.println(cost20) System.out.println System.out System System.out cost20 String[] args args public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//マスの数(N+1)
		int N = sc.nextInt();
		//コストのかかるマスの数
		int M = sc.nextInt();
		//初期位置
		int X = sc.nextInt();

		int[] costMasu = new int[M];

		for(int i = 0; i < M; i++){
		    costMasu[i] = sc.nextInt();
		}

		int cost2N = 0;
		int cost20 = 0;

		for(int j = X; j <= N; j++){
		    for(int k = 0; k < M; k++){
			if(costMasu[k] == j){
			    cost2N++;
			}
		    }
		}

		for(int l = X; l > 0; l--){
		    for(int m = 0; m < M; m++){
			if(costMasu[m] == l){
			    cost20++;
			}
		    }
		}

		if(cost2N <= cost20){
		    System.out.println(cost2N);
		}else{
		    System.out.println(cost20);
		}
	}
} public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//マスの数(N+1)
		int N = sc.nextInt();
		//コストのかかるマスの数
		int M = sc.nextInt();
		//初期位置
		int X = sc.nextInt();

		int[] costMasu = new int[M];

		for(int i = 0; i < M; i++){
		    costMasu[i] = sc.nextInt();
		}

		int cost2N = 0;
		int cost20 = 0;

		for(int j = X; j <= N; j++){
		    for(int k = 0; k < M; k++){
			if(costMasu[k] == j){
			    cost2N++;
			}
		    }
		}

		for(int l = X; l > 0; l--){
		    for(int m = 0; m < M; m++){
			if(costMasu[m] == l){
			    cost20++;
			}
		    }
		}

		if(cost2N <= cost20){
		    System.out.println(cost2N);
		}else{
		    System.out.println(cost20);
		}
	}
} Main
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//マスの数(N+1)
		int N = sc.nextInt();
		//コストのかかるマスの数
		int M = sc.nextInt();
		//初期位置
		int X = sc.nextInt();

		int[] costMasu = new int[M];

		for(int i = 0; i < M; i++){
		    costMasu[i] = sc.nextInt();
		}

		int cost2N = 0;
		int cost20 = 0;

		for(int j = X; j <= N; j++){
		    for(int k = 0; k < M; k++){
			if(costMasu[k] == j){
			    cost2N++;
			}
		    }
		}

		for(int l = X; l > 0; l--){
		    for(int m = 0; m < M; m++){
			if(costMasu[m] == l){
			    cost20++;
			}
		    }
		}

		if(cost2N <= cost20){
		    System.out.println(cost2N);
		}else{
		    System.out.println(cost20);
		}
	}
}