import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] nmx = scanner.nextLine().split(" ", 3);
        int n = Integer.parseInt(nmx[0]);
        int m = Integer.parseInt(nmx[1]);
        int x = Integer.parseInt(nmx[2]);

        String[] line = scanner.nextLine().split(" ", m);
        int[] gates = new int[m];
        for (int i = 0; i < m; i++) {
            gates[i] = Integer.parseInt(line[i]);
        }

        int nCost = 0;
        int zCost = 0;
        for (int i = 0; i < m; i++) {
            if (gates[i] > x) {
                nCost++;
            }
            if (gates[i] < x) {
                zCost++;
            }
        }
        System.out.println(Math.min(nCost, zCost));
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] nmx = scanner.nextLine().split(" ", 3);
        int n = Integer.parseInt(nmx[0]);
        int m = Integer.parseInt(nmx[1]);
        int x = Integer.parseInt(nmx[2]);

        String[] line = scanner.nextLine().split(" ", m);
        int[] gates = new int[m];
        for (int i = 0; i < m; i++) {
            gates[i] = Integer.parseInt(line[i]);
        }

        int nCost = 0;
        int zCost = 0;
        for (int i = 0; i < m; i++) {
            if (gates[i] > x) {
                nCost++;
            }
            if (gates[i] < x) {
                zCost++;
            }
        }
        System.out.println(Math.min(nCost, zCost));
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] nmx = scanner.nextLine().split(" ", 3);
        int n = Integer.parseInt(nmx[0]);
        int m = Integer.parseInt(nmx[1]);
        int x = Integer.parseInt(nmx[2]);

        String[] line = scanner.nextLine().split(" ", m);
        int[] gates = new int[m];
        for (int i = 0; i < m; i++) {
            gates[i] = Integer.parseInt(line[i]);
        }

        int nCost = 0;
        int zCost = 0;
        for (int i = 0; i < m; i++) {
            if (gates[i] > x) {
                nCost++;
            }
            if (gates[i] < x) {
                zCost++;
            }
        }
        System.out.println(Math.min(nCost, zCost));
    } main {
        Scanner scanner = new Scanner(System.in);
        String[] nmx = scanner.nextLine().split(" ", 3);
        int n = Integer.parseInt(nmx[0]);
        int m = Integer.parseInt(nmx[1]);
        int x = Integer.parseInt(nmx[2]);

        String[] line = scanner.nextLine().split(" ", m);
        int[] gates = new int[m];
        for (int i = 0; i < m; i++) {
            gates[i] = Integer.parseInt(line[i]);
        }

        int nCost = 0;
        int zCost = 0;
        for (int i = 0; i < m; i++) {
            if (gates[i] > x) {
                nCost++;
            }
            if (gates[i] < x) {
                zCost++;
            }
        }
        System.out.println(Math.min(nCost, zCost));
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String[] nmx = scanner.nextLine().split(" ", 3); nmx scanner.nextLine().split(" ", 3) scanner.nextLine().split scanner.nextLine() scanner.nextLine scanner " " 3 int n = Integer.parseInt(nmx[0]); n Integer.parseInt(nmx[0]) Integer.parseInt Integer nmx[0] nmx 0 int m = Integer.parseInt(nmx[1]); m Integer.parseInt(nmx[1]) Integer.parseInt Integer nmx[1] nmx 1 int x = Integer.parseInt(nmx[2]); x Integer.parseInt(nmx[2]) Integer.parseInt Integer nmx[2] nmx 2 String[] line = scanner.nextLine().split(" ", m); line scanner.nextLine().split(" ", m) scanner.nextLine().split scanner.nextLine() scanner.nextLine scanner " " m int[] gates = new int[m]; gates new int[m] m for (int i = 0; i < m; i++) {
            gates[i] = Integer.parseInt(line[i]);
        } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
            gates[i] = Integer.parseInt(line[i]);
        } {
            gates[i] = Integer.parseInt(line[i]);
        } gates[i] = Integer.parseInt(line[i]) gates[i] gates i Integer.parseInt(line[i]) Integer.parseInt Integer line[i] line i int nCost = 0; nCost 0 int zCost = 0; zCost 0 for (int i = 0; i < m; i++) {
            if (gates[i] > x) {
                nCost++;
            }
            if (gates[i] < x) {
                zCost++;
            }
        } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
            if (gates[i] > x) {
                nCost++;
            }
            if (gates[i] < x) {
                zCost++;
            }
        } {
            if (gates[i] > x) {
                nCost++;
            }
            if (gates[i] < x) {
                zCost++;
            }
        } if (gates[i] > x) {
                nCost++;
            } gates[i] > x gates[i] gates i x {
                nCost++;
            } nCost++ nCost if (gates[i] < x) {
                zCost++;
            } gates[i] < x gates[i] gates i x {
                zCost++;
            } zCost++ zCost System.out.println(Math.min(nCost, zCost)) System.out.println System.out System System.out Math.min(nCost, zCost) Math.min Math nCost zCost String[] args args
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] nmx = scanner.nextLine().split(" ", 3);
        int n = Integer.parseInt(nmx[0]);
        int m = Integer.parseInt(nmx[1]);
        int x = Integer.parseInt(nmx[2]);

        String[] line = scanner.nextLine().split(" ", m);
        int[] gates = new int[m];
        for (int i = 0; i < m; i++) {
            gates[i] = Integer.parseInt(line[i]);
        }

        int nCost = 0;
        int zCost = 0;
        for (int i = 0; i < m; i++) {
            if (gates[i] > x) {
                nCost++;
            }
            if (gates[i] < x) {
                zCost++;
            }
        }
        System.out.println(Math.min(nCost, zCost));
    }
}
