import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int x = scanner.nextInt();
        List<Integer> placeList = new ArrayList<>();
        for (int i = 0; i < n + 1; i++) {
            placeList.add(0);
        }
        int[] costPlaceList = new int[m];
        for (int i = 0; i < m; i++) {
            costPlaceList[i] =scanner.nextInt();
        }

        for(int costPlace : costPlaceList){
            placeList.set(costPlace, 1);
        }

        int leftCost = sum(placeList.subList(0, x));
        int rightCost = sum(placeList.subList(x+1, placeList.size()));

        if(leftCost < rightCost) {
            System.out.println(leftCost);
        } else {
            System.out.println(rightCost);
        }
    }

    private static int sum(List<Integer> list){
        int result = 0;
        for(int element : list) {
            result += element;
        }
        return result;
    }
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int x = scanner.nextInt();
        List<Integer> placeList = new ArrayList<>();
        for (int i = 0; i < n + 1; i++) {
            placeList.add(0);
        }
        int[] costPlaceList = new int[m];
        for (int i = 0; i < m; i++) {
            costPlaceList[i] =scanner.nextInt();
        }

        for(int costPlace : costPlaceList){
            placeList.set(costPlace, 1);
        }

        int leftCost = sum(placeList.subList(0, x));
        int rightCost = sum(placeList.subList(x+1, placeList.size()));

        if(leftCost < rightCost) {
            System.out.println(leftCost);
        } else {
            System.out.println(rightCost);
        }
    }

    private static int sum(List<Integer> list){
        int result = 0;
        for(int element : list) {
            result += element;
        }
        return result;
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int x = scanner.nextInt();
        List<Integer> placeList = new ArrayList<>();
        for (int i = 0; i < n + 1; i++) {
            placeList.add(0);
        }
        int[] costPlaceList = new int[m];
        for (int i = 0; i < m; i++) {
            costPlaceList[i] =scanner.nextInt();
        }

        for(int costPlace : costPlaceList){
            placeList.set(costPlace, 1);
        }

        int leftCost = sum(placeList.subList(0, x));
        int rightCost = sum(placeList.subList(x+1, placeList.size()));

        if(leftCost < rightCost) {
            System.out.println(leftCost);
        } else {
            System.out.println(rightCost);
        }
    } main {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int x = scanner.nextInt();
        List<Integer> placeList = new ArrayList<>();
        for (int i = 0; i < n + 1; i++) {
            placeList.add(0);
        }
        int[] costPlaceList = new int[m];
        for (int i = 0; i < m; i++) {
            costPlaceList[i] =scanner.nextInt();
        }

        for(int costPlace : costPlaceList){
            placeList.set(costPlace, 1);
        }

        int leftCost = sum(placeList.subList(0, x));
        int rightCost = sum(placeList.subList(x+1, placeList.size()));

        if(leftCost < rightCost) {
            System.out.println(leftCost);
        } else {
            System.out.println(rightCost);
        }
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int m = scanner.nextInt(); m scanner.nextInt() scanner.nextInt scanner int x = scanner.nextInt(); x scanner.nextInt() scanner.nextInt scanner List<Integer> placeList = new ArrayList<>(); placeList new ArrayList<>() for (int i = 0; i < n + 1; i++) {
            placeList.add(0);
        } int i = 0; int i = 0; i 0 i < n + 1 i n + 1 n 1 i++ i++ i {
            placeList.add(0);
        } {
            placeList.add(0);
        } placeList.add(0) placeList.add placeList 0 int[] costPlaceList = new int[m]; costPlaceList new int[m] m for (int i = 0; i < m; i++) {
            costPlaceList[i] =scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
            costPlaceList[i] =scanner.nextInt();
        } {
            costPlaceList[i] =scanner.nextInt();
        } costPlaceList[i] =scanner.nextInt() costPlaceList[i] costPlaceList i scanner.nextInt() scanner.nextInt scanner for(int costPlace : costPlaceList){
            placeList.set(costPlace, 1);
        } int costPlace costPlaceList {
            placeList.set(costPlace, 1);
        } {
            placeList.set(costPlace, 1);
        } placeList.set(costPlace, 1) placeList.set placeList costPlace 1 int leftCost = sum(placeList.subList(0, x)); leftCost sum(placeList.subList(0, x)) sum placeList.subList(0, x) placeList.subList placeList 0 x int rightCost = sum(placeList.subList(x+1, placeList.size())); rightCost sum(placeList.subList(x+1, placeList.size())) sum placeList.subList(x+1, placeList.size()) placeList.subList placeList x+1 x 1 placeList.size() placeList.size placeList if(leftCost < rightCost) {
            System.out.println(leftCost);
        } else {
            System.out.println(rightCost);
        } leftCost < rightCost leftCost rightCost {
            System.out.println(leftCost);
        } System.out.println(leftCost) System.out.println System.out System System.out leftCost {
            System.out.println(rightCost);
        } System.out.println(rightCost) System.out.println System.out System System.out rightCost String[] args args private static int sum(List<Integer> list){
        int result = 0;
        for(int element : list) {
            result += element;
        }
        return result;
    } sum {
        int result = 0;
        for(int element : list) {
            result += element;
        }
        return result;
    } int result = 0; result 0 for(int element : list) {
            result += element;
        } int element list {
            result += element;
        } {
            result += element;
        } result += element result element return result; result List<Integer> list list public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int x = scanner.nextInt();
        List<Integer> placeList = new ArrayList<>();
        for (int i = 0; i < n + 1; i++) {
            placeList.add(0);
        }
        int[] costPlaceList = new int[m];
        for (int i = 0; i < m; i++) {
            costPlaceList[i] =scanner.nextInt();
        }

        for(int costPlace : costPlaceList){
            placeList.set(costPlace, 1);
        }

        int leftCost = sum(placeList.subList(0, x));
        int rightCost = sum(placeList.subList(x+1, placeList.size()));

        if(leftCost < rightCost) {
            System.out.println(leftCost);
        } else {
            System.out.println(rightCost);
        }
    }

    private static int sum(List<Integer> list){
        int result = 0;
        for(int element : list) {
            result += element;
        }
        return result;
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int x = scanner.nextInt();
        List<Integer> placeList = new ArrayList<>();
        for (int i = 0; i < n + 1; i++) {
            placeList.add(0);
        }
        int[] costPlaceList = new int[m];
        for (int i = 0; i < m; i++) {
            costPlaceList[i] =scanner.nextInt();
        }

        for(int costPlace : costPlaceList){
            placeList.set(costPlace, 1);
        }

        int leftCost = sum(placeList.subList(0, x));
        int rightCost = sum(placeList.subList(x+1, placeList.size()));

        if(leftCost < rightCost) {
            System.out.println(leftCost);
        } else {
            System.out.println(rightCost);
        }
    }

    private static int sum(List<Integer> list){
        int result = 0;
        for(int element : list) {
            result += element;
        }
        return result;
    }
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int x = scanner.nextInt();
        List<Integer> placeList = new ArrayList<>();
        for (int i = 0; i < n + 1; i++) {
            placeList.add(0);
        }
        int[] costPlaceList = new int[m];
        for (int i = 0; i < m; i++) {
            costPlaceList[i] =scanner.nextInt();
        }

        for(int costPlace : costPlaceList){
            placeList.set(costPlace, 1);
        }

        int leftCost = sum(placeList.subList(0, x));
        int rightCost = sum(placeList.subList(x+1, placeList.size()));

        if(leftCost < rightCost) {
            System.out.println(leftCost);
        } else {
            System.out.println(rightCost);
        }
    }

    private static int sum(List<Integer> list){
        int result = 0;
        for(int element : list) {
            result += element;
        }
        return result;
    }
}
