import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int n = scan.nextInt();
	int m = scan.nextInt();
	int x = scan.nextInt();
	int[] a = new int[m];
	int[] cost = new int[n+1];
	for(int i = 0; i < m; i++){
	    a[i] = scan.nextInt();
	    cost[a[i]]++;
	}

	int[] ruiseki = new int[n+1];
	for(int i = 1; i < n+1; i++){
	    ruiseki[i] = ruiseki[i-1]+cost[i];
	}

	if(ruiseki[x-1] >= (ruiseki[n]-ruiseki[x])){
	    System.out.println(ruiseki[n]-ruiseki[x]);
	}else{
	    System.out.println(ruiseki[x-1]);
	}
    }
}
			        import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int n = scan.nextInt();
	int m = scan.nextInt();
	int x = scan.nextInt();
	int[] a = new int[m];
	int[] cost = new int[n+1];
	for(int i = 0; i < m; i++){
	    a[i] = scan.nextInt();
	    cost[a[i]]++;
	}

	int[] ruiseki = new int[n+1];
	for(int i = 1; i < n+1; i++){
	    ruiseki[i] = ruiseki[i-1]+cost[i];
	}

	if(ruiseki[x-1] >= (ruiseki[n]-ruiseki[x])){
	    System.out.println(ruiseki[n]-ruiseki[x]);
	}else{
	    System.out.println(ruiseki[x-1]);
	}
    }
} Main public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int n = scan.nextInt();
	int m = scan.nextInt();
	int x = scan.nextInt();
	int[] a = new int[m];
	int[] cost = new int[n+1];
	for(int i = 0; i < m; i++){
	    a[i] = scan.nextInt();
	    cost[a[i]]++;
	}

	int[] ruiseki = new int[n+1];
	for(int i = 1; i < n+1; i++){
	    ruiseki[i] = ruiseki[i-1]+cost[i];
	}

	if(ruiseki[x-1] >= (ruiseki[n]-ruiseki[x])){
	    System.out.println(ruiseki[n]-ruiseki[x]);
	}else{
	    System.out.println(ruiseki[x-1]);
	}
    } main {
	Scanner scan = new Scanner(System.in);

	int n = scan.nextInt();
	int m = scan.nextInt();
	int x = scan.nextInt();
	int[] a = new int[m];
	int[] cost = new int[n+1];
	for(int i = 0; i < m; i++){
	    a[i] = scan.nextInt();
	    cost[a[i]]++;
	}

	int[] ruiseki = new int[n+1];
	for(int i = 1; i < n+1; i++){
	    ruiseki[i] = ruiseki[i-1]+cost[i];
	}

	if(ruiseki[x-1] >= (ruiseki[n]-ruiseki[x])){
	    System.out.println(ruiseki[n]-ruiseki[x]);
	}else{
	    System.out.println(ruiseki[x-1]);
	}
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int m = scan.nextInt(); m scan.nextInt() scan.nextInt scan int x = scan.nextInt(); x scan.nextInt() scan.nextInt scan int[] a = new int[m]; a new int[m] m int[] cost = new int[n+1]; cost new int[n+1] n+1 n 1 for(int i = 0; i < m; i++){
	    a[i] = scan.nextInt();
	    cost[a[i]]++;
	} int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
	    a[i] = scan.nextInt();
	    cost[a[i]]++;
	} {
	    a[i] = scan.nextInt();
	    cost[a[i]]++;
	} a[i] = scan.nextInt() a[i] a i scan.nextInt() scan.nextInt scan cost[a[i]]++ cost[a[i]] cost a[i] a i int[] ruiseki = new int[n+1]; ruiseki new int[n+1] n+1 n 1 for(int i = 1; i < n+1; i++){
	    ruiseki[i] = ruiseki[i-1]+cost[i];
	} int i = 1; int i = 1; i 1 i < n+1 i n+1 n 1 i++ i++ i {
	    ruiseki[i] = ruiseki[i-1]+cost[i];
	} {
	    ruiseki[i] = ruiseki[i-1]+cost[i];
	} ruiseki[i] = ruiseki[i-1]+cost[i] ruiseki[i] ruiseki i ruiseki[i-1]+cost[i] ruiseki[i-1] ruiseki i-1 i 1 cost[i] cost i if(ruiseki[x-1] >= (ruiseki[n]-ruiseki[x])){
	    System.out.println(ruiseki[n]-ruiseki[x]);
	}else{
	    System.out.println(ruiseki[x-1]);
	} ruiseki[x-1] >= (ruiseki[n]-ruiseki[x]) ruiseki[x-1] ruiseki x-1 x 1 (ruiseki[n]-ruiseki[x]) ruiseki[n] ruiseki n ruiseki[x] ruiseki x {
	    System.out.println(ruiseki[n]-ruiseki[x]);
	} System.out.println(ruiseki[n]-ruiseki[x]) System.out.println System.out System System.out ruiseki[n]-ruiseki[x] ruiseki[n] ruiseki n ruiseki[x] ruiseki x {
	    System.out.println(ruiseki[x-1]);
	} System.out.println(ruiseki[x-1]) System.out.println System.out System System.out ruiseki[x-1] ruiseki x-1 x 1 String[] args args public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int n = scan.nextInt();
	int m = scan.nextInt();
	int x = scan.nextInt();
	int[] a = new int[m];
	int[] cost = new int[n+1];
	for(int i = 0; i < m; i++){
	    a[i] = scan.nextInt();
	    cost[a[i]]++;
	}

	int[] ruiseki = new int[n+1];
	for(int i = 1; i < n+1; i++){
	    ruiseki[i] = ruiseki[i-1]+cost[i];
	}

	if(ruiseki[x-1] >= (ruiseki[n]-ruiseki[x])){
	    System.out.println(ruiseki[n]-ruiseki[x]);
	}else{
	    System.out.println(ruiseki[x-1]);
	}
    }
} public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int n = scan.nextInt();
	int m = scan.nextInt();
	int x = scan.nextInt();
	int[] a = new int[m];
	int[] cost = new int[n+1];
	for(int i = 0; i < m; i++){
	    a[i] = scan.nextInt();
	    cost[a[i]]++;
	}

	int[] ruiseki = new int[n+1];
	for(int i = 1; i < n+1; i++){
	    ruiseki[i] = ruiseki[i-1]+cost[i];
	}

	if(ruiseki[x-1] >= (ruiseki[n]-ruiseki[x])){
	    System.out.println(ruiseki[n]-ruiseki[x]);
	}else{
	    System.out.println(ruiseki[x-1]);
	}
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int n = scan.nextInt();
	int m = scan.nextInt();
	int x = scan.nextInt();
	int[] a = new int[m];
	int[] cost = new int[n+1];
	for(int i = 0; i < m; i++){
	    a[i] = scan.nextInt();
	    cost[a[i]]++;
	}

	int[] ruiseki = new int[n+1];
	for(int i = 1; i < n+1; i++){
	    ruiseki[i] = ruiseki[i-1]+cost[i];
	}

	if(ruiseki[x-1] >= (ruiseki[n]-ruiseki[x])){
	    System.out.println(ruiseki[n]-ruiseki[x]);
	}else{
	    System.out.println(ruiseki[x-1]);
	}
    }
}
			       
