import java.util.*;

public class Main {
    public static void main(String[] args) {	
	Main main = new Main();
    	main.solveB();
    }
    
    private void solveA() {
    	Scanner sc = new Scanner(System.in);
    	int A = sc.nextInt();
    	int B = sc.nextInt();
	int X = sc.nextInt();	
    	System.out.println(A > X ? "NO" : (A+B >= X ? "YES" : "NO"));
    }

    private void solveB() {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
    	int M = sc.nextInt();
	int X = sc.nextInt();

	int[] a = new int[M];

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

	int ans1=0;
	for(int i=X; i > 0; i--){
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans1++;	    
	    }
	}

	int ans2=0;
	for(int i=X; i < N; i++){
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans2++;	    
	    }
	}
	System.out.println(Math.min(ans1,ans2));
    }
    private void solveC() {
	Scanner sc = new Scanner(System.in);
	System.out.println();
    }
    private void solveD() {
	Scanner sc = new Scanner(System.in);
	System.out.println();
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {	
	Main main = new Main();
    	main.solveB();
    }
    
    private void solveA() {
    	Scanner sc = new Scanner(System.in);
    	int A = sc.nextInt();
    	int B = sc.nextInt();
	int X = sc.nextInt();	
    	System.out.println(A > X ? "NO" : (A+B >= X ? "YES" : "NO"));
    }

    private void solveB() {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
    	int M = sc.nextInt();
	int X = sc.nextInt();

	int[] a = new int[M];

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

	int ans1=0;
	for(int i=X; i > 0; i--){
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans1++;	    
	    }
	}

	int ans2=0;
	for(int i=X; i < N; i++){
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans2++;	    
	    }
	}
	System.out.println(Math.min(ans1,ans2));
    }
    private void solveC() {
	Scanner sc = new Scanner(System.in);
	System.out.println();
    }
    private void solveD() {
	Scanner sc = new Scanner(System.in);
	System.out.println();
    }
} Main public static void main(String[] args) {	
	Main main = new Main();
    	main.solveB();
    } main {	
	Main main = new Main();
    	main.solveB();
    } Main main = new Main(); main new Main() main.solveB() main.solveB main String[] args args private void solveA() {
    	Scanner sc = new Scanner(System.in);
    	int A = sc.nextInt();
    	int B = sc.nextInt();
	int X = sc.nextInt();	
    	System.out.println(A > X ? "NO" : (A+B >= X ? "YES" : "NO"));
    } solveA {
    	Scanner sc = new Scanner(System.in);
    	int A = sc.nextInt();
    	int B = sc.nextInt();
	int X = sc.nextInt();	
    	System.out.println(A > X ? "NO" : (A+B >= X ? "YES" : "NO"));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int A = sc.nextInt(); A sc.nextInt() sc.nextInt sc int B = sc.nextInt(); B sc.nextInt() sc.nextInt sc int X = sc.nextInt(); X sc.nextInt() sc.nextInt sc System.out.println(A > X ? "NO" : (A+B >= X ? "YES" : "NO")) System.out.println System.out System System.out A > X ? "NO" : (A+B >= X ? "YES" : "NO") A > X A X "NO" (A+B >= X ? "YES" : "NO") A+B >= X A+B A B X "YES" "NO" private void solveB() {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
    	int M = sc.nextInt();
	int X = sc.nextInt();

	int[] a = new int[M];

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

	int ans1=0;
	for(int i=X; i > 0; i--){
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans1++;	    
	    }
	}

	int ans2=0;
	for(int i=X; i < N; i++){
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans2++;	    
	    }
	}
	System.out.println(Math.min(ans1,ans2));
    } solveB {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
    	int M = sc.nextInt();
	int X = sc.nextInt();

	int[] a = new int[M];

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

	int ans1=0;
	for(int i=X; i > 0; i--){
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans1++;	    
	    }
	}

	int ans2=0;
	for(int i=X; i < N; i++){
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans2++;	    
	    }
	}
	System.out.println(Math.min(ans1,ans2));
    } 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[] a = new int[M]; a new int[M] M for(int i=0; i < M; i++){
	    a[i] = sc.nextInt();	    
	} int i=0; int i=0; i 0 i < M i M i++ i++ i {
	    a[i] = sc.nextInt();	    
	} {
	    a[i] = sc.nextInt();	    
	} a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc int ans1=0; ans1 0 for(int i=X; i > 0; i--){
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans1++;	    
	    }
	} int i=X; int i=X; i X i > 0 i 0 i-- i-- i {
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans1++;	    
	    }
	} {
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans1++;	    
	    }
	} for(int j=0; j < M; j++){
		if (a[j] == i) ans1++;	    
	    } int j=0; int j=0; j 0 j < M j M j++ j++ j {
		if (a[j] == i) ans1++;	    
	    } {
		if (a[j] == i) ans1++;	    
	    } if (a[j] == i) ans1++; a[j] == i a[j] a j i ans1++ ans1 int ans2=0; ans2 0 for(int i=X; i < N; i++){
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans2++;	    
	    }
	} int i=X; int i=X; i X i < N i N i++ i++ i {
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans2++;	    
	    }
	} {
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans2++;	    
	    }
	} for(int j=0; j < M; j++){
		if (a[j] == i) ans2++;	    
	    } int j=0; int j=0; j 0 j < M j M j++ j++ j {
		if (a[j] == i) ans2++;	    
	    } {
		if (a[j] == i) ans2++;	    
	    } if (a[j] == i) ans2++; a[j] == i a[j] a j i ans2++ ans2 System.out.println(Math.min(ans1,ans2)) System.out.println System.out System System.out Math.min(ans1,ans2) Math.min Math ans1 ans2 private void solveC() {
	Scanner sc = new Scanner(System.in);
	System.out.println();
    } solveC {
	Scanner sc = new Scanner(System.in);
	System.out.println();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) System.out.println() System.out.println System.out System System.out private void solveD() {
	Scanner sc = new Scanner(System.in);
	System.out.println();
    } solveD {
	Scanner sc = new Scanner(System.in);
	System.out.println();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) System.out.println() System.out.println System.out System System.out public class Main {
    public static void main(String[] args) {	
	Main main = new Main();
    	main.solveB();
    }
    
    private void solveA() {
    	Scanner sc = new Scanner(System.in);
    	int A = sc.nextInt();
    	int B = sc.nextInt();
	int X = sc.nextInt();	
    	System.out.println(A > X ? "NO" : (A+B >= X ? "YES" : "NO"));
    }

    private void solveB() {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
    	int M = sc.nextInt();
	int X = sc.nextInt();

	int[] a = new int[M];

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

	int ans1=0;
	for(int i=X; i > 0; i--){
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans1++;	    
	    }
	}

	int ans2=0;
	for(int i=X; i < N; i++){
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans2++;	    
	    }
	}
	System.out.println(Math.min(ans1,ans2));
    }
    private void solveC() {
	Scanner sc = new Scanner(System.in);
	System.out.println();
    }
    private void solveD() {
	Scanner sc = new Scanner(System.in);
	System.out.println();
    }
} public class Main {
    public static void main(String[] args) {	
	Main main = new Main();
    	main.solveB();
    }
    
    private void solveA() {
    	Scanner sc = new Scanner(System.in);
    	int A = sc.nextInt();
    	int B = sc.nextInt();
	int X = sc.nextInt();	
    	System.out.println(A > X ? "NO" : (A+B >= X ? "YES" : "NO"));
    }

    private void solveB() {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
    	int M = sc.nextInt();
	int X = sc.nextInt();

	int[] a = new int[M];

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

	int ans1=0;
	for(int i=X; i > 0; i--){
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans1++;	    
	    }
	}

	int ans2=0;
	for(int i=X; i < N; i++){
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans2++;	    
	    }
	}
	System.out.println(Math.min(ans1,ans2));
    }
    private void solveC() {
	Scanner sc = new Scanner(System.in);
	System.out.println();
    }
    private void solveD() {
	Scanner sc = new Scanner(System.in);
	System.out.println();
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {	
	Main main = new Main();
    	main.solveB();
    }
    
    private void solveA() {
    	Scanner sc = new Scanner(System.in);
    	int A = sc.nextInt();
    	int B = sc.nextInt();
	int X = sc.nextInt();	
    	System.out.println(A > X ? "NO" : (A+B >= X ? "YES" : "NO"));
    }

    private void solveB() {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
    	int M = sc.nextInt();
	int X = sc.nextInt();

	int[] a = new int[M];

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

	int ans1=0;
	for(int i=X; i > 0; i--){
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans1++;	    
	    }
	}

	int ans2=0;
	for(int i=X; i < N; i++){
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans2++;	    
	    }
	}
	System.out.println(Math.min(ans1,ans2));
    }
    private void solveC() {
	Scanner sc = new Scanner(System.in);
	System.out.println();
    }
    private void solveD() {
	Scanner sc = new Scanner(System.in);
	System.out.println();
    }
}