import java.lang.Math;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

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();
        Set<Integer> gates = new HashSet<>();

        for (int i = 0; i < m; i++) {
            gates.add(sc.nextInt());
        }

        int left_cost = 0;
        for (int i = 0; i < x; i++) {
            if (gates.contains(i)) { left_cost++; };
        }

        int right_cost = 0;
        for (int i = x + 1; i <= n; i++) {
            if (gates.contains(i)) { right_cost++; };
        }

        System.out.println(Math.min(left_cost, right_cost));
    }
} import java.lang.Math; Math java.lang import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util import java.util.Set; Set java.util 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();
        Set<Integer> gates = new HashSet<>();

        for (int i = 0; i < m; i++) {
            gates.add(sc.nextInt());
        }

        int left_cost = 0;
        for (int i = 0; i < x; i++) {
            if (gates.contains(i)) { left_cost++; };
        }

        int right_cost = 0;
        for (int i = x + 1; i <= n; i++) {
            if (gates.contains(i)) { right_cost++; };
        }

        System.out.println(Math.min(left_cost, right_cost));
    }
} 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();
        Set<Integer> gates = new HashSet<>();

        for (int i = 0; i < m; i++) {
            gates.add(sc.nextInt());
        }

        int left_cost = 0;
        for (int i = 0; i < x; i++) {
            if (gates.contains(i)) { left_cost++; };
        }

        int right_cost = 0;
        for (int i = x + 1; i <= n; i++) {
            if (gates.contains(i)) { right_cost++; };
        }

        System.out.println(Math.min(left_cost, right_cost));
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int x = sc.nextInt();
        Set<Integer> gates = new HashSet<>();

        for (int i = 0; i < m; i++) {
            gates.add(sc.nextInt());
        }

        int left_cost = 0;
        for (int i = 0; i < x; i++) {
            if (gates.contains(i)) { left_cost++; };
        }

        int right_cost = 0;
        for (int i = x + 1; i <= n; i++) {
            if (gates.contains(i)) { right_cost++; };
        }

        System.out.println(Math.min(left_cost, right_cost));
    } 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 Set<Integer> gates = new HashSet<>(); gates new HashSet<>() for (int i = 0; i < m; i++) {
            gates.add(sc.nextInt());
        } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
            gates.add(sc.nextInt());
        } {
            gates.add(sc.nextInt());
        } gates.add(sc.nextInt()) gates.add gates sc.nextInt() sc.nextInt sc int left_cost = 0; left_cost 0 for (int i = 0; i < x; i++) {
            if (gates.contains(i)) { left_cost++; };
        } int i = 0; int i = 0; i 0 i < x i x i++ i++ i {
            if (gates.contains(i)) { left_cost++; };
        } {
            if (gates.contains(i)) { left_cost++; };
        } if (gates.contains(i)) { left_cost++; } gates.contains(i) gates.contains gates i { left_cost++; } left_cost++ left_cost int right_cost = 0; right_cost 0 for (int i = x + 1; i <= n; i++) {
            if (gates.contains(i)) { right_cost++; };
        } int i = x + 1; int i = x + 1; i x + 1 x 1 i <= n i n i++ i++ i {
            if (gates.contains(i)) { right_cost++; };
        } {
            if (gates.contains(i)) { right_cost++; };
        } if (gates.contains(i)) { right_cost++; } gates.contains(i) gates.contains gates i { right_cost++; } right_cost++ right_cost System.out.println(Math.min(left_cost, right_cost)) System.out.println System.out System System.out Math.min(left_cost, right_cost) Math.min Math left_cost right_cost String[] args args
import java.lang.Math;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

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();
        Set<Integer> gates = new HashSet<>();

        for (int i = 0; i < m; i++) {
            gates.add(sc.nextInt());
        }

        int left_cost = 0;
        for (int i = 0; i < x; i++) {
            if (gates.contains(i)) { left_cost++; };
        }

        int right_cost = 0;
        for (int i = x + 1; i <= n; i++) {
            if (gates.contains(i)) { right_cost++; };
        }

        System.out.println(Math.min(left_cost, right_cost));
    }
}
