import java.util.*;
import java.io.*;
 
public class Main{
    public static void main(String[] args){
        Main m = new Main();
        m.input();
    }
 
    public void input(){
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int p = sc.nextInt();
        int n = sc.nextInt();
        ArrayList<Integer> parkList = new ArrayList<Integer>();
        for(int i = 0; i < p; i++){
            parkList.add(sc.nextInt());
        }
        int zero = 0;
        int max = 0;
        Collections.sort(parkList);
        for(int i = 0; i < n; i++){
            if(parkList.contains(i)){
                zero++;
            }
        }
        for(int i = m; i > n; i--){
            if(parkList.contains(i)){
                max++;
            }
        }
        System.out.println(Math.min(zero,max));
        sc.close();
    }
    

} import java.util.*; util.* java import java.io.*; io.* java public class Main{
    public static void main(String[] args){
        Main m = new Main();
        m.input();
    }
 
    public void input(){
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int p = sc.nextInt();
        int n = sc.nextInt();
        ArrayList<Integer> parkList = new ArrayList<Integer>();
        for(int i = 0; i < p; i++){
            parkList.add(sc.nextInt());
        }
        int zero = 0;
        int max = 0;
        Collections.sort(parkList);
        for(int i = 0; i < n; i++){
            if(parkList.contains(i)){
                zero++;
            }
        }
        for(int i = m; i > n; i--){
            if(parkList.contains(i)){
                max++;
            }
        }
        System.out.println(Math.min(zero,max));
        sc.close();
    }
    

} Main public static void main(String[] args){
        Main m = new Main();
        m.input();
    } main {
        Main m = new Main();
        m.input();
    } Main m = new Main(); m new Main() m.input() m.input m String[] args args public void input(){
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int p = sc.nextInt();
        int n = sc.nextInt();
        ArrayList<Integer> parkList = new ArrayList<Integer>();
        for(int i = 0; i < p; i++){
            parkList.add(sc.nextInt());
        }
        int zero = 0;
        int max = 0;
        Collections.sort(parkList);
        for(int i = 0; i < n; i++){
            if(parkList.contains(i)){
                zero++;
            }
        }
        for(int i = m; i > n; i--){
            if(parkList.contains(i)){
                max++;
            }
        }
        System.out.println(Math.min(zero,max));
        sc.close();
    } input {
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int p = sc.nextInt();
        int n = sc.nextInt();
        ArrayList<Integer> parkList = new ArrayList<Integer>();
        for(int i = 0; i < p; i++){
            parkList.add(sc.nextInt());
        }
        int zero = 0;
        int max = 0;
        Collections.sort(parkList);
        for(int i = 0; i < n; i++){
            if(parkList.contains(i)){
                zero++;
            }
        }
        for(int i = m; i > n; i--){
            if(parkList.contains(i)){
                max++;
            }
        }
        System.out.println(Math.min(zero,max));
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int m = sc.nextInt(); m sc.nextInt() sc.nextInt sc int p = sc.nextInt(); p sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc ArrayList<Integer> parkList = new ArrayList<Integer>(); parkList new ArrayList<Integer>() for(int i = 0; i < p; i++){
            parkList.add(sc.nextInt());
        } int i = 0; int i = 0; i 0 i < p i p i++ i++ i {
            parkList.add(sc.nextInt());
        } {
            parkList.add(sc.nextInt());
        } parkList.add(sc.nextInt()) parkList.add parkList sc.nextInt() sc.nextInt sc int zero = 0; zero 0 int max = 0; max 0 Collections.sort(parkList) Collections.sort Collections parkList for(int i = 0; i < n; i++){
            if(parkList.contains(i)){
                zero++;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            if(parkList.contains(i)){
                zero++;
            }
        } {
            if(parkList.contains(i)){
                zero++;
            }
        } if(parkList.contains(i)){
                zero++;
            } parkList.contains(i) parkList.contains parkList i {
                zero++;
            } zero++ zero for(int i = m; i > n; i--){
            if(parkList.contains(i)){
                max++;
            }
        } int i = m; int i = m; i m i > n i n i-- i-- i {
            if(parkList.contains(i)){
                max++;
            }
        } {
            if(parkList.contains(i)){
                max++;
            }
        } if(parkList.contains(i)){
                max++;
            } parkList.contains(i) parkList.contains parkList i {
                max++;
            } max++ max System.out.println(Math.min(zero,max)) System.out.println System.out System System.out Math.min(zero,max) Math.min Math zero max sc.close() sc.close sc public class Main{
    public static void main(String[] args){
        Main m = new Main();
        m.input();
    }
 
    public void input(){
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int p = sc.nextInt();
        int n = sc.nextInt();
        ArrayList<Integer> parkList = new ArrayList<Integer>();
        for(int i = 0; i < p; i++){
            parkList.add(sc.nextInt());
        }
        int zero = 0;
        int max = 0;
        Collections.sort(parkList);
        for(int i = 0; i < n; i++){
            if(parkList.contains(i)){
                zero++;
            }
        }
        for(int i = m; i > n; i--){
            if(parkList.contains(i)){
                max++;
            }
        }
        System.out.println(Math.min(zero,max));
        sc.close();
    }
    

} public class Main{
    public static void main(String[] args){
        Main m = new Main();
        m.input();
    }
 
    public void input(){
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int p = sc.nextInt();
        int n = sc.nextInt();
        ArrayList<Integer> parkList = new ArrayList<Integer>();
        for(int i = 0; i < p; i++){
            parkList.add(sc.nextInt());
        }
        int zero = 0;
        int max = 0;
        Collections.sort(parkList);
        for(int i = 0; i < n; i++){
            if(parkList.contains(i)){
                zero++;
            }
        }
        for(int i = m; i > n; i--){
            if(parkList.contains(i)){
                max++;
            }
        }
        System.out.println(Math.min(zero,max));
        sc.close();
    }
    

} Main
import java.util.*;
import java.io.*;
 
public class Main{
    public static void main(String[] args){
        Main m = new Main();
        m.input();
    }
 
    public void input(){
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int p = sc.nextInt();
        int n = sc.nextInt();
        ArrayList<Integer> parkList = new ArrayList<Integer>();
        for(int i = 0; i < p; i++){
            parkList.add(sc.nextInt());
        }
        int zero = 0;
        int max = 0;
        Collections.sort(parkList);
        for(int i = 0; i < n; i++){
            if(parkList.contains(i)){
                zero++;
            }
        }
        for(int i = m; i > n; i--){
            if(parkList.contains(i)){
                max++;
            }
        }
        System.out.println(Math.min(zero,max));
        sc.close();
    }
    

}