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 goal_0 = 0;
        int goal_n = 0;

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

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

        int[] a = new int[m];
        for (int i = 0; i < m; i++) {
            a[i] = sc.nextInt();
            if (a[i] < x) {
                goal_0++;
            }
            if (a[i] > x) {
                goal_n++;
            }
        }
        System.out.println(Math.min(goal_0,goal_n));
    } main {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int m = sc.nextInt();
        int x = sc.nextInt();
        int goal_0 = 0;
        int goal_n = 0;

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

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

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

        int[] a = new int[m];
        for (int i = 0; i < m; i++) {
            a[i] = sc.nextInt();
            if (a[i] < x) {
                goal_0++;
            }
            if (a[i] > x) {
                goal_n++;
            }
        }
        System.out.println(Math.min(goal_0,goal_n));
    }
}