import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int M = in.nextInt();
            int X = in.nextInt();
            int[] A = new int[M];
            for (int i = 0; i < M; i++) {
                A[i] = in.nextInt();
            }

            int[] costs = new int[N + 1];
            for (int i = 0; i < M; i++) {
                costs[A[i]]++;
            }

            int min = (int) 1e9;
            {
                int cost = 0;
                for (int x = X; x <= N; x++) {
                    cost += costs[x];
                }
                min = Math.min(min, cost);
            }
            {
                int cost = 0;
                for (int x = X; x >= 0; x--) {
                    cost += costs[x];
                }
                min = Math.min(min, cost);
            }

            System.out.println(min);
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int M = in.nextInt();
            int X = in.nextInt();
            int[] A = new int[M];
            for (int i = 0; i < M; i++) {
                A[i] = in.nextInt();
            }

            int[] costs = new int[N + 1];
            for (int i = 0; i < M; i++) {
                costs[A[i]]++;
            }

            int min = (int) 1e9;
            {
                int cost = 0;
                for (int x = X; x <= N; x++) {
                    cost += costs[x];
                }
                min = Math.min(min, cost);
            }
            {
                int cost = 0;
                for (int x = X; x >= 0; x--) {
                    cost += costs[x];
                }
                min = Math.min(min, cost);
            }

            System.out.println(min);
        }
    }
} Main public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int M = in.nextInt();
            int X = in.nextInt();
            int[] A = new int[M];
            for (int i = 0; i < M; i++) {
                A[i] = in.nextInt();
            }

            int[] costs = new int[N + 1];
            for (int i = 0; i < M; i++) {
                costs[A[i]]++;
            }

            int min = (int) 1e9;
            {
                int cost = 0;
                for (int x = X; x <= N; x++) {
                    cost += costs[x];
                }
                min = Math.min(min, cost);
            }
            {
                int cost = 0;
                for (int x = X; x >= 0; x--) {
                    cost += costs[x];
                }
                min = Math.min(min, cost);
            }

            System.out.println(min);
        }
    } main {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int M = in.nextInt();
            int X = in.nextInt();
            int[] A = new int[M];
            for (int i = 0; i < M; i++) {
                A[i] = in.nextInt();
            }

            int[] costs = new int[N + 1];
            for (int i = 0; i < M; i++) {
                costs[A[i]]++;
            }

            int min = (int) 1e9;
            {
                int cost = 0;
                for (int x = X; x <= N; x++) {
                    cost += costs[x];
                }
                min = Math.min(min, cost);
            }
            {
                int cost = 0;
                for (int x = X; x >= 0; x--) {
                    cost += costs[x];
                }
                min = Math.min(min, cost);
            }

            System.out.println(min);
        }
    } try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int M = in.nextInt();
            int X = in.nextInt();
            int[] A = new int[M];
            for (int i = 0; i < M; i++) {
                A[i] = in.nextInt();
            }

            int[] costs = new int[N + 1];
            for (int i = 0; i < M; i++) {
                costs[A[i]]++;
            }

            int min = (int) 1e9;
            {
                int cost = 0;
                for (int x = X; x <= N; x++) {
                    cost += costs[x];
                }
                min = Math.min(min, cost);
            }
            {
                int cost = 0;
                for (int x = X; x >= 0; x--) {
                    cost += costs[x];
                }
                min = Math.min(min, cost);
            }

            System.out.println(min);
        } {
            int N = in.nextInt();
            int M = in.nextInt();
            int X = in.nextInt();
            int[] A = new int[M];
            for (int i = 0; i < M; i++) {
                A[i] = in.nextInt();
            }

            int[] costs = new int[N + 1];
            for (int i = 0; i < M; i++) {
                costs[A[i]]++;
            }

            int min = (int) 1e9;
            {
                int cost = 0;
                for (int x = X; x <= N; x++) {
                    cost += costs[x];
                }
                min = Math.min(min, cost);
            }
            {
                int cost = 0;
                for (int x = X; x >= 0; x--) {
                    cost += costs[x];
                }
                min = Math.min(min, cost);
            }

            System.out.println(min);
        } Scanner in = new Scanner(System.in) Scanner in = new Scanner(System.in) new Scanner(System.in) int N = in.nextInt(); N in.nextInt() in.nextInt in int M = in.nextInt(); M in.nextInt() in.nextInt in int X = in.nextInt(); X in.nextInt() in.nextInt in int[] A = new int[M]; A new int[M] M for (int i = 0; i < M; i++) {
                A[i] = in.nextInt();
            } int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
                A[i] = in.nextInt();
            } {
                A[i] = in.nextInt();
            } A[i] = in.nextInt() A[i] A i in.nextInt() in.nextInt in int[] costs = new int[N + 1]; costs new int[N + 1] N + 1 N 1 for (int i = 0; i < M; i++) {
                costs[A[i]]++;
            } int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
                costs[A[i]]++;
            } {
                costs[A[i]]++;
            } costs[A[i]]++ costs[A[i]] costs A[i] A i int min = (int) 1e9; min (int) 1e9 {
                int cost = 0;
                for (int x = X; x <= N; x++) {
                    cost += costs[x];
                }
                min = Math.min(min, cost);
            } int cost = 0; cost 0 for (int x = X; x <= N; x++) {
                    cost += costs[x];
                } int x = X; int x = X; x X x <= N x N x++ x++ x {
                    cost += costs[x];
                } {
                    cost += costs[x];
                } cost += costs[x] cost costs[x] costs x min = Math.min(min, cost) min Math.min(min, cost) Math.min Math min cost {
                int cost = 0;
                for (int x = X; x >= 0; x--) {
                    cost += costs[x];
                }
                min = Math.min(min, cost);
            } int cost = 0; cost 0 for (int x = X; x >= 0; x--) {
                    cost += costs[x];
                } int x = X; int x = X; x X x >= 0 x 0 x-- x-- x {
                    cost += costs[x];
                } {
                    cost += costs[x];
                } cost += costs[x] cost costs[x] costs x min = Math.min(min, cost) min Math.min(min, cost) Math.min Math min cost System.out.println(min) System.out.println System.out System System.out min String[] args args public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int M = in.nextInt();
            int X = in.nextInt();
            int[] A = new int[M];
            for (int i = 0; i < M; i++) {
                A[i] = in.nextInt();
            }

            int[] costs = new int[N + 1];
            for (int i = 0; i < M; i++) {
                costs[A[i]]++;
            }

            int min = (int) 1e9;
            {
                int cost = 0;
                for (int x = X; x <= N; x++) {
                    cost += costs[x];
                }
                min = Math.min(min, cost);
            }
            {
                int cost = 0;
                for (int x = X; x >= 0; x--) {
                    cost += costs[x];
                }
                min = Math.min(min, cost);
            }

            System.out.println(min);
        }
    }
} public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int M = in.nextInt();
            int X = in.nextInt();
            int[] A = new int[M];
            for (int i = 0; i < M; i++) {
                A[i] = in.nextInt();
            }

            int[] costs = new int[N + 1];
            for (int i = 0; i < M; i++) {
                costs[A[i]]++;
            }

            int min = (int) 1e9;
            {
                int cost = 0;
                for (int x = X; x <= N; x++) {
                    cost += costs[x];
                }
                min = Math.min(min, cost);
            }
            {
                int cost = 0;
                for (int x = X; x >= 0; x--) {
                    cost += costs[x];
                }
                min = Math.min(min, cost);
            }

            System.out.println(min);
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int M = in.nextInt();
            int X = in.nextInt();
            int[] A = new int[M];
            for (int i = 0; i < M; i++) {
                A[i] = in.nextInt();
            }

            int[] costs = new int[N + 1];
            for (int i = 0; i < M; i++) {
                costs[A[i]]++;
            }

            int min = (int) 1e9;
            {
                int cost = 0;
                for (int x = X; x <= N; x++) {
                    cost += costs[x];
                }
                min = Math.min(min, cost);
            }
            {
                int cost = 0;
                for (int x = X; x >= 0; x--) {
                    cost += costs[x];
                }
                min = Math.min(min, cost);
            }

            System.out.println(min);
        }
    }
}
