import java.util.Scanner;

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 a[] = new int[m];
		
		for (int i = 0; i < m; i++) {
			a[i] = sc.nextInt();
		}
		
		int count0 = 0;
		int countn = 0;
		
		for (int i = 0; i < m; i++) {
			if (a[i] < x){
				count0++;
			}
		}
		
		for (int i = 0; i < m; i++) {
			if (a[i] > x && a[i] < n){
				countn++;
			}
		}
		
		System.out.println(Math.min(count0, countn));
	}
} import java.util.Scanner; Scanner 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 a[] = new int[m];
		
		for (int i = 0; i < m; i++) {
			a[i] = sc.nextInt();
		}
		
		int count0 = 0;
		int countn = 0;
		
		for (int i = 0; i < m; i++) {
			if (a[i] < x){
				count0++;
			}
		}
		
		for (int i = 0; i < m; i++) {
			if (a[i] > x && a[i] < n){
				countn++;
			}
		}
		
		System.out.println(Math.min(count0, countn));
	}
} 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 a[] = new int[m];
		
		for (int i = 0; i < m; i++) {
			a[i] = sc.nextInt();
		}
		
		int count0 = 0;
		int countn = 0;
		
		for (int i = 0; i < m; i++) {
			if (a[i] < x){
				count0++;
			}
		}
		
		for (int i = 0; i < m; i++) {
			if (a[i] > x && a[i] < n){
				countn++;
			}
		}
		
		System.out.println(Math.min(count0, countn));
	} main {
		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 count0 = 0;
		int countn = 0;
		
		for (int i = 0; i < m; i++) {
			if (a[i] < x){
				count0++;
			}
		}
		
		for (int i = 0; i < m; i++) {
			if (a[i] > x && a[i] < n){
				countn++;
			}
		}
		
		System.out.println(Math.min(count0, countn));
	} 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 count0 = 0; count0 0 int countn = 0; countn 0 for (int i = 0; i < m; i++) {
			if (a[i] < x){
				count0++;
			}
		} int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
			if (a[i] < x){
				count0++;
			}
		} {
			if (a[i] < x){
				count0++;
			}
		} if (a[i] < x){
				count0++;
			} a[i] < x a[i] a i x {
				count0++;
			} count0++ count0 for (int i = 0; i < m; i++) {
			if (a[i] > x && a[i] < n){
				countn++;
			}
		} int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
			if (a[i] > x && a[i] < n){
				countn++;
			}
		} {
			if (a[i] > x && a[i] < n){
				countn++;
			}
		} if (a[i] > x && a[i] < n){
				countn++;
			} a[i] > x && a[i] < n a[i] > x a[i] a i x a[i] < n a[i] a i n {
				countn++;
			} countn++ countn System.out.println(Math.min(count0, countn)) System.out.println System.out System System.out Math.min(count0, countn) Math.min Math count0 countn 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 a[] = new int[m];
		
		for (int i = 0; i < m; i++) {
			a[i] = sc.nextInt();
		}
		
		int count0 = 0;
		int countn = 0;
		
		for (int i = 0; i < m; i++) {
			if (a[i] < x){
				count0++;
			}
		}
		
		for (int i = 0; i < m; i++) {
			if (a[i] > x && a[i] < n){
				countn++;
			}
		}
		
		System.out.println(Math.min(count0, countn));
	}
} 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 a[] = new int[m];
		
		for (int i = 0; i < m; i++) {
			a[i] = sc.nextInt();
		}
		
		int count0 = 0;
		int countn = 0;
		
		for (int i = 0; i < m; i++) {
			if (a[i] < x){
				count0++;
			}
		}
		
		for (int i = 0; i < m; i++) {
			if (a[i] > x && a[i] < n){
				countn++;
			}
		}
		
		System.out.println(Math.min(count0, countn));
	}
} Main
import java.util.Scanner;

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 a[] = new int[m];
		
		for (int i = 0; i < m; i++) {
			a[i] = sc.nextInt();
		}
		
		int count0 = 0;
		int countn = 0;
		
		for (int i = 0; i < m; i++) {
			if (a[i] < x){
				count0++;
			}
		}
		
		for (int i = 0; i < m; i++) {
			if (a[i] > x && a[i] < n){
				countn++;
			}
		}
		
		System.out.println(Math.min(count0, countn));
	}
}