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[] map = new int[N+1];
    	for (int i = 0; i < M; i++) {
    		map[sc.nextInt()] = 1;
    	}
    	int cost1 = 0;
    	int cost2 = 0;
    	for (int i = X+1; i < N; i++) {
    		cost1 += map[i];
    	}
    	for (int i = X-1; 0 < i; i--) {
    		cost2 += map[i];
    	}
    	System.out.println(Math.min(cost1, cost2));
    }
} 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[] map = new int[N+1];
    	for (int i = 0; i < M; i++) {
    		map[sc.nextInt()] = 1;
    	}
    	int cost1 = 0;
    	int cost2 = 0;
    	for (int i = X+1; i < N; i++) {
    		cost1 += map[i];
    	}
    	for (int i = X-1; 0 < i; i--) {
    		cost2 += map[i];
    	}
    	System.out.println(Math.min(cost1, cost2));
    }
} 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[] map = new int[N+1];
    	for (int i = 0; i < M; i++) {
    		map[sc.nextInt()] = 1;
    	}
    	int cost1 = 0;
    	int cost2 = 0;
    	for (int i = X+1; i < N; i++) {
    		cost1 += map[i];
    	}
    	for (int i = X-1; 0 < i; i--) {
    		cost2 += map[i];
    	}
    	System.out.println(Math.min(cost1, cost2));
    } main {
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int M = sc.nextInt();
    	int X = sc.nextInt();
    	int[] map = new int[N+1];
    	for (int i = 0; i < M; i++) {
    		map[sc.nextInt()] = 1;
    	}
    	int cost1 = 0;
    	int cost2 = 0;
    	for (int i = X+1; i < N; i++) {
    		cost1 += map[i];
    	}
    	for (int i = X-1; 0 < i; i--) {
    		cost2 += map[i];
    	}
    	System.out.println(Math.min(cost1, cost2));
    } 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[] map = new int[N+1]; map new int[N+1] N+1 N 1 for (int i = 0; i < M; i++) {
    		map[sc.nextInt()] = 1;
    	} int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
    		map[sc.nextInt()] = 1;
    	} {
    		map[sc.nextInt()] = 1;
    	} map[sc.nextInt()] = 1 map[sc.nextInt()] map sc.nextInt() sc.nextInt sc 1 int cost1 = 0; cost1 0 int cost2 = 0; cost2 0 for (int i = X+1; i < N; i++) {
    		cost1 += map[i];
    	} int i = X+1; int i = X+1; i X+1 X 1 i < N i N i++ i++ i {
    		cost1 += map[i];
    	} {
    		cost1 += map[i];
    	} cost1 += map[i] cost1 map[i] map i for (int i = X-1; 0 < i; i--) {
    		cost2 += map[i];
    	} int i = X-1; int i = X-1; i X-1 X 1 0 < i 0 i i-- i-- i {
    		cost2 += map[i];
    	} {
    		cost2 += map[i];
    	} cost2 += map[i] cost2 map[i] map i System.out.println(Math.min(cost1, cost2)) System.out.println System.out System System.out Math.min(cost1, cost2) Math.min Math cost1 cost2 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[] map = new int[N+1];
    	for (int i = 0; i < M; i++) {
    		map[sc.nextInt()] = 1;
    	}
    	int cost1 = 0;
    	int cost2 = 0;
    	for (int i = X+1; i < N; i++) {
    		cost1 += map[i];
    	}
    	for (int i = X-1; 0 < i; i--) {
    		cost2 += map[i];
    	}
    	System.out.println(Math.min(cost1, cost2));
    }
} 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[] map = new int[N+1];
    	for (int i = 0; i < M; i++) {
    		map[sc.nextInt()] = 1;
    	}
    	int cost1 = 0;
    	int cost2 = 0;
    	for (int i = X+1; i < N; i++) {
    		cost1 += map[i];
    	}
    	for (int i = X-1; 0 < i; i--) {
    		cost2 += map[i];
    	}
    	System.out.println(Math.min(cost1, cost2));
    }
} 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[] map = new int[N+1];
    	for (int i = 0; i < M; i++) {
    		map[sc.nextInt()] = 1;
    	}
    	int cost1 = 0;
    	int cost2 = 0;
    	for (int i = X+1; i < N; i++) {
    		cost1 += map[i];
    	}
    	for (int i = X-1; 0 < i; i--) {
    		cost2 += map[i];
    	}
    	System.out.println(Math.min(cost1, cost2));
    }
}