
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		int x = Integer.parseInt(sc.next());
		int f = 0;
		int l = 0;
		for (int i = 1; i <= m; i++) {
			int a = Integer.parseInt(sc.next());
			if (a < x) {
				f++;
			}
			if (a > x) {
				l++;
			}
		}
		System.out.println(Math.min(f, l));
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		int x = Integer.parseInt(sc.next());
		int f = 0;
		int l = 0;
		for (int i = 1; i <= m; i++) {
			int a = Integer.parseInt(sc.next());
			if (a < x) {
				f++;
			}
			if (a > x) {
				l++;
			}
		}
		System.out.println(Math.min(f, l));
		sc.close();
	}
} Main public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		int x = Integer.parseInt(sc.next());
		int f = 0;
		int l = 0;
		for (int i = 1; i <= m; i++) {
			int a = Integer.parseInt(sc.next());
			if (a < x) {
				f++;
			}
			if (a > x) {
				l++;
			}
		}
		System.out.println(Math.min(f, l));
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		int x = Integer.parseInt(sc.next());
		int f = 0;
		int l = 0;
		for (int i = 1; i <= m; i++) {
			int a = Integer.parseInt(sc.next());
			if (a < x) {
				f++;
			}
			if (a > x) {
				l++;
			}
		}
		System.out.println(Math.min(f, l));
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int m = Integer.parseInt(sc.next()); m Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int x = Integer.parseInt(sc.next()); x Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int f = 0; f 0 int l = 0; l 0 for (int i = 1; i <= m; i++) {
			int a = Integer.parseInt(sc.next());
			if (a < x) {
				f++;
			}
			if (a > x) {
				l++;
			}
		} int i = 1; int i = 1; i 1 i <= m i m i++ i++ i {
			int a = Integer.parseInt(sc.next());
			if (a < x) {
				f++;
			}
			if (a > x) {
				l++;
			}
		} {
			int a = Integer.parseInt(sc.next());
			if (a < x) {
				f++;
			}
			if (a > x) {
				l++;
			}
		} int a = Integer.parseInt(sc.next()); a Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc if (a < x) {
				f++;
			} a < x a x {
				f++;
			} f++ f if (a > x) {
				l++;
			} a > x a x {
				l++;
			} l++ l System.out.println(Math.min(f, l)) System.out.println System.out System System.out Math.min(f, l) Math.min Math f l sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		int x = Integer.parseInt(sc.next());
		int f = 0;
		int l = 0;
		for (int i = 1; i <= m; i++) {
			int a = Integer.parseInt(sc.next());
			if (a < x) {
				f++;
			}
			if (a > x) {
				l++;
			}
		}
		System.out.println(Math.min(f, l));
		sc.close();
	}
} public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		int x = Integer.parseInt(sc.next());
		int f = 0;
		int l = 0;
		for (int i = 1; i <= m; i++) {
			int a = Integer.parseInt(sc.next());
			if (a < x) {
				f++;
			}
			if (a > x) {
				l++;
			}
		}
		System.out.println(Math.min(f, l));
		sc.close();
	}
} Main

import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		int x = Integer.parseInt(sc.next());
		int f = 0;
		int l = 0;
		for (int i = 1; i <= m; i++) {
			int a = Integer.parseInt(sc.next());
			if (a < x) {
				f++;
			}
			if (a > x) {
				l++;
			}
		}
		System.out.println(Math.min(f, l));
		sc.close();
	}
}