import java.util.Scanner;

// B - Toll Gates
// https://atcoder.jp/contests/abc094/tasks/abc094_b
public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int N = Integer.parseInt(scanner.next());
        int M = Integer.parseInt(scanner.next());
        int X = Integer.parseInt(scanner.next());
        boolean[] A = new boolean[N + 1];
        for (int i = 0; i < M; i++) {
            int index = Integer.parseInt(scanner.next());
            A[index] = true;
        }
        scanner.close();

        int costA = 0;
        for (int i = X; i <= N; i++) {
            if (A[i]) costA++;
        }
        int costB = 0;
        for (int i = X; i >= 0; i--) {
            if (A[i]) costB++;
        }

        System.out.println(Math.min(costA, costB));
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int N = Integer.parseInt(scanner.next());
        int M = Integer.parseInt(scanner.next());
        int X = Integer.parseInt(scanner.next());
        boolean[] A = new boolean[N + 1];
        for (int i = 0; i < M; i++) {
            int index = Integer.parseInt(scanner.next());
            A[index] = true;
        }
        scanner.close();

        int costA = 0;
        for (int i = X; i <= N; i++) {
            if (A[i]) costA++;
        }
        int costB = 0;
        for (int i = X; i >= 0; i--) {
            if (A[i]) costB++;
        }

        System.out.println(Math.min(costA, costB));
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int N = Integer.parseInt(scanner.next());
        int M = Integer.parseInt(scanner.next());
        int X = Integer.parseInt(scanner.next());
        boolean[] A = new boolean[N + 1];
        for (int i = 0; i < M; i++) {
            int index = Integer.parseInt(scanner.next());
            A[index] = true;
        }
        scanner.close();

        int costA = 0;
        for (int i = X; i <= N; i++) {
            if (A[i]) costA++;
        }
        int costB = 0;
        for (int i = X; i >= 0; i--) {
            if (A[i]) costB++;
        }

        System.out.println(Math.min(costA, costB));
    } main {
        Scanner scanner = new Scanner(System.in);

        int N = Integer.parseInt(scanner.next());
        int M = Integer.parseInt(scanner.next());
        int X = Integer.parseInt(scanner.next());
        boolean[] A = new boolean[N + 1];
        for (int i = 0; i < M; i++) {
            int index = Integer.parseInt(scanner.next());
            A[index] = true;
        }
        scanner.close();

        int costA = 0;
        for (int i = X; i <= N; i++) {
            if (A[i]) costA++;
        }
        int costB = 0;
        for (int i = X; i >= 0; i--) {
            if (A[i]) costB++;
        }

        System.out.println(Math.min(costA, costB));
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = Integer.parseInt(scanner.next()); N Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner int M = Integer.parseInt(scanner.next()); M Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner int X = Integer.parseInt(scanner.next()); X Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner boolean[] A = new boolean[N + 1]; A new boolean[N + 1] N + 1 N 1 for (int i = 0; i < M; i++) {
            int index = Integer.parseInt(scanner.next());
            A[index] = true;
        } int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
            int index = Integer.parseInt(scanner.next());
            A[index] = true;
        } {
            int index = Integer.parseInt(scanner.next());
            A[index] = true;
        } int index = Integer.parseInt(scanner.next()); index Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner A[index] = true A[index] A index true scanner.close() scanner.close scanner int costA = 0; costA 0 for (int i = X; i <= N; i++) {
            if (A[i]) costA++;
        } int i = X; int i = X; i X i <= N i N i++ i++ i {
            if (A[i]) costA++;
        } {
            if (A[i]) costA++;
        } if (A[i]) costA++; A[i] A i costA++ costA int costB = 0; costB 0 for (int i = X; i >= 0; i--) {
            if (A[i]) costB++;
        } int i = X; int i = X; i X i >= 0 i 0 i-- i-- i {
            if (A[i]) costB++;
        } {
            if (A[i]) costB++;
        } if (A[i]) costB++; A[i] A i costB++ costB System.out.println(Math.min(costA, costB)) System.out.println System.out System System.out Math.min(costA, costB) Math.min Math costA costB String[] args args public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int N = Integer.parseInt(scanner.next());
        int M = Integer.parseInt(scanner.next());
        int X = Integer.parseInt(scanner.next());
        boolean[] A = new boolean[N + 1];
        for (int i = 0; i < M; i++) {
            int index = Integer.parseInt(scanner.next());
            A[index] = true;
        }
        scanner.close();

        int costA = 0;
        for (int i = X; i <= N; i++) {
            if (A[i]) costA++;
        }
        int costB = 0;
        for (int i = X; i >= 0; i--) {
            if (A[i]) costB++;
        }

        System.out.println(Math.min(costA, costB));
    }
} public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int N = Integer.parseInt(scanner.next());
        int M = Integer.parseInt(scanner.next());
        int X = Integer.parseInt(scanner.next());
        boolean[] A = new boolean[N + 1];
        for (int i = 0; i < M; i++) {
            int index = Integer.parseInt(scanner.next());
            A[index] = true;
        }
        scanner.close();

        int costA = 0;
        for (int i = X; i <= N; i++) {
            if (A[i]) costA++;
        }
        int costB = 0;
        for (int i = X; i >= 0; i--) {
            if (A[i]) costB++;
        }

        System.out.println(Math.min(costA, costB));
    }
} Main
import java.util.Scanner;

// B - Toll Gates
// https://atcoder.jp/contests/abc094/tasks/abc094_b
public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int N = Integer.parseInt(scanner.next());
        int M = Integer.parseInt(scanner.next());
        int X = Integer.parseInt(scanner.next());
        boolean[] A = new boolean[N + 1];
        for (int i = 0; i < M; i++) {
            int index = Integer.parseInt(scanner.next());
            A[index] = true;
        }
        scanner.close();

        int costA = 0;
        for (int i = X; i <= N; i++) {
            if (A[i]) costA++;
        }
        int costB = 0;
        for (int i = X; i >= 0; i--) {
            if (A[i]) costB++;
        }

        System.out.println(Math.min(costA, costB));
    }
}
