import java.util.Scanner;
import java.util.Arrays;
class Main{
    public static void main(String arg[]){
        Scanner scn=new Scanner(System.in);
        int n = scn.nextInt();
        int m = scn.nextInt();
        int x = scn.nextInt();
        int[] line = new int[n];
        Arrays.fill(line,0);
        for(int i=0;i<m;i++){
            int buf = scn.nextInt();
            line[buf]++;
        }
        int rCost = 0;
        int lCost = 0;
        for(int i=0;i<n;i++){
            if(line[i]==1&&i<x){
                rCost++;
            }else if(line[i]==1){
                lCost++;
            }
        }
        System.out.println(Math.min(rCost,lCost));
    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util class Main{
    public static void main(String arg[]){
        Scanner scn=new Scanner(System.in);
        int n = scn.nextInt();
        int m = scn.nextInt();
        int x = scn.nextInt();
        int[] line = new int[n];
        Arrays.fill(line,0);
        for(int i=0;i<m;i++){
            int buf = scn.nextInt();
            line[buf]++;
        }
        int rCost = 0;
        int lCost = 0;
        for(int i=0;i<n;i++){
            if(line[i]==1&&i<x){
                rCost++;
            }else if(line[i]==1){
                lCost++;
            }
        }
        System.out.println(Math.min(rCost,lCost));
    }
} Main public static void main(String arg[]){
        Scanner scn=new Scanner(System.in);
        int n = scn.nextInt();
        int m = scn.nextInt();
        int x = scn.nextInt();
        int[] line = new int[n];
        Arrays.fill(line,0);
        for(int i=0;i<m;i++){
            int buf = scn.nextInt();
            line[buf]++;
        }
        int rCost = 0;
        int lCost = 0;
        for(int i=0;i<n;i++){
            if(line[i]==1&&i<x){
                rCost++;
            }else if(line[i]==1){
                lCost++;
            }
        }
        System.out.println(Math.min(rCost,lCost));
    } main {
        Scanner scn=new Scanner(System.in);
        int n = scn.nextInt();
        int m = scn.nextInt();
        int x = scn.nextInt();
        int[] line = new int[n];
        Arrays.fill(line,0);
        for(int i=0;i<m;i++){
            int buf = scn.nextInt();
            line[buf]++;
        }
        int rCost = 0;
        int lCost = 0;
        for(int i=0;i<n;i++){
            if(line[i]==1&&i<x){
                rCost++;
            }else if(line[i]==1){
                lCost++;
            }
        }
        System.out.println(Math.min(rCost,lCost));
    } Scanner scn=new Scanner(System.in); scn new Scanner(System.in) int n = scn.nextInt(); n scn.nextInt() scn.nextInt scn int m = scn.nextInt(); m scn.nextInt() scn.nextInt scn int x = scn.nextInt(); x scn.nextInt() scn.nextInt scn int[] line = new int[n]; line new int[n] n Arrays.fill(line,0) Arrays.fill Arrays line 0 for(int i=0;i<m;i++){
            int buf = scn.nextInt();
            line[buf]++;
        } int i=0; int i=0; i 0 i<m i m i++ i++ i {
            int buf = scn.nextInt();
            line[buf]++;
        } {
            int buf = scn.nextInt();
            line[buf]++;
        } int buf = scn.nextInt(); buf scn.nextInt() scn.nextInt scn line[buf]++ line[buf] line buf int rCost = 0; rCost 0 int lCost = 0; lCost 0 for(int i=0;i<n;i++){
            if(line[i]==1&&i<x){
                rCost++;
            }else if(line[i]==1){
                lCost++;
            }
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            if(line[i]==1&&i<x){
                rCost++;
            }else if(line[i]==1){
                lCost++;
            }
        } {
            if(line[i]==1&&i<x){
                rCost++;
            }else if(line[i]==1){
                lCost++;
            }
        } if(line[i]==1&&i<x){
                rCost++;
            }else if(line[i]==1){
                lCost++;
            } line[i]==1&&i<x line[i]==1 line[i] line i 1 i<x i x {
                rCost++;
            } rCost++ rCost if(line[i]==1){
                lCost++;
            } line[i]==1 line[i] line i 1 {
                lCost++;
            } lCost++ lCost System.out.println(Math.min(rCost,lCost)) System.out.println System.out System System.out Math.min(rCost,lCost) Math.min Math rCost lCost String arg[] arg
import java.util.Scanner;
import java.util.Arrays;
class Main{
    public static void main(String arg[]){
        Scanner scn=new Scanner(System.in);
        int n = scn.nextInt();
        int m = scn.nextInt();
        int x = scn.nextInt();
        int[] line = new int[n];
        Arrays.fill(line,0);
        for(int i=0;i<m;i++){
            int buf = scn.nextInt();
            line[buf]++;
        }
        int rCost = 0;
        int lCost = 0;
        for(int i=0;i<n;i++){
            if(line[i]==1&&i<x){
                rCost++;
            }else if(line[i]==1){
                lCost++;
            }
        }
        System.out.println(Math.min(rCost,lCost));
    }
}
