

import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();

		boolean gate[] = new boolean[n + 1];
		for(int i = 0; i < m; i++){
			gate[sc.nextInt()] = true;
		}

		int result = 0;
		int tmp = 0;
		for(int i = x; i >= 0; i--){
			if(gate[i]){
				tmp++;
			}
		}

		result = tmp;

		tmp = 0;
		for(int i = x; i <= n; i++){
			if(gate[i]){
				tmp++;
			}
		}

		result = Math.min(result, tmp);

		System.out.println(result);
	}
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();

		boolean gate[] = new boolean[n + 1];
		for(int i = 0; i < m; i++){
			gate[sc.nextInt()] = true;
		}

		int result = 0;
		int tmp = 0;
		for(int i = x; i >= 0; i--){
			if(gate[i]){
				tmp++;
			}
		}

		result = tmp;

		tmp = 0;
		for(int i = x; i <= n; i++){
			if(gate[i]){
				tmp++;
			}
		}

		result = Math.min(result, tmp);

		System.out.println(result);
	}
} Main public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();

		boolean gate[] = new boolean[n + 1];
		for(int i = 0; i < m; i++){
			gate[sc.nextInt()] = true;
		}

		int result = 0;
		int tmp = 0;
		for(int i = x; i >= 0; i--){
			if(gate[i]){
				tmp++;
			}
		}

		result = tmp;

		tmp = 0;
		for(int i = x; i <= n; i++){
			if(gate[i]){
				tmp++;
			}
		}

		result = Math.min(result, tmp);

		System.out.println(result);
	} main {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();

		boolean gate[] = new boolean[n + 1];
		for(int i = 0; i < m; i++){
			gate[sc.nextInt()] = true;
		}

		int result = 0;
		int tmp = 0;
		for(int i = x; i >= 0; i--){
			if(gate[i]){
				tmp++;
			}
		}

		result = tmp;

		tmp = 0;
		for(int i = x; i <= n; i++){
			if(gate[i]){
				tmp++;
			}
		}

		result = Math.min(result, tmp);

		System.out.println(result);
	} 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 boolean gate[] = new boolean[n + 1]; gate new boolean[n + 1] n + 1 n 1 for(int i = 0; i < m; i++){
			gate[sc.nextInt()] = true;
		} int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
			gate[sc.nextInt()] = true;
		} {
			gate[sc.nextInt()] = true;
		} gate[sc.nextInt()] = true gate[sc.nextInt()] gate sc.nextInt() sc.nextInt sc true int result = 0; result 0 int tmp = 0; tmp 0 for(int i = x; i >= 0; i--){
			if(gate[i]){
				tmp++;
			}
		} int i = x; int i = x; i x i >= 0 i 0 i-- i-- i {
			if(gate[i]){
				tmp++;
			}
		} {
			if(gate[i]){
				tmp++;
			}
		} if(gate[i]){
				tmp++;
			} gate[i] gate i {
				tmp++;
			} tmp++ tmp result = tmp result tmp tmp = 0 tmp 0 for(int i = x; i <= n; i++){
			if(gate[i]){
				tmp++;
			}
		} int i = x; int i = x; i x i <= n i n i++ i++ i {
			if(gate[i]){
				tmp++;
			}
		} {
			if(gate[i]){
				tmp++;
			}
		} if(gate[i]){
				tmp++;
			} gate[i] gate i {
				tmp++;
			} tmp++ tmp result = Math.min(result, tmp) result Math.min(result, tmp) Math.min Math result tmp System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();

		boolean gate[] = new boolean[n + 1];
		for(int i = 0; i < m; i++){
			gate[sc.nextInt()] = true;
		}

		int result = 0;
		int tmp = 0;
		for(int i = x; i >= 0; i--){
			if(gate[i]){
				tmp++;
			}
		}

		result = tmp;

		tmp = 0;
		for(int i = x; i <= n; i++){
			if(gate[i]){
				tmp++;
			}
		}

		result = Math.min(result, tmp);

		System.out.println(result);
	}
} public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();

		boolean gate[] = new boolean[n + 1];
		for(int i = 0; i < m; i++){
			gate[sc.nextInt()] = true;
		}

		int result = 0;
		int tmp = 0;
		for(int i = x; i >= 0; i--){
			if(gate[i]){
				tmp++;
			}
		}

		result = tmp;

		tmp = 0;
		for(int i = x; i <= n; i++){
			if(gate[i]){
				tmp++;
			}
		}

		result = Math.min(result, tmp);

		System.out.println(result);
	}
} Main


import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();

		boolean gate[] = new boolean[n + 1];
		for(int i = 0; i < m; i++){
			gate[sc.nextInt()] = true;
		}

		int result = 0;
		int tmp = 0;
		for(int i = x; i >= 0; i--){
			if(gate[i]){
				tmp++;
			}
		}

		result = tmp;

		tmp = 0;
		for(int i = x; i <= n; i++){
			if(gate[i]){
				tmp++;
			}
		}

		result = Math.min(result, tmp);

		System.out.println(result);
	}
}
