import java.util.*;

public 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();
        int[] array = new int[n];
        for(int i=0; i<m; i++){
            int a = sc.nextInt();
            array[a] = 1;
        }

        int costMinus = 0;
        int costPlus = 0;

        for(int i=x; i>=0; i--){
            costMinus+=array[i];
        }

        for(int i=x; i<n; i++){
            costPlus+=array[i];
        }

        System.out.println(Math.min(costMinus, costPlus));
    }

    public static void printArray(int[] array){
        for(int i=0; i<array.length; i++){
            if(i == array.length){
                System.out.println(array[i]);
            } else {
                System.out.print(String.format("%d ", array[i]));
            }
        }
    }

    public static int gcd(int a, int b){
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    public static int lcm(int a, int b){
        return a * b / gcd(a, b);
    }
} import java.util.*; util.* java public 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();
        int[] array = new int[n];
        for(int i=0; i<m; i++){
            int a = sc.nextInt();
            array[a] = 1;
        }

        int costMinus = 0;
        int costPlus = 0;

        for(int i=x; i>=0; i--){
            costMinus+=array[i];
        }

        for(int i=x; i<n; i++){
            costPlus+=array[i];
        }

        System.out.println(Math.min(costMinus, costPlus));
    }

    public static void printArray(int[] array){
        for(int i=0; i<array.length; i++){
            if(i == array.length){
                System.out.println(array[i]);
            } else {
                System.out.print(String.format("%d ", array[i]));
            }
        }
    }

    public static int gcd(int a, int b){
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    public static int lcm(int a, int b){
        return a * b / gcd(a, b);
    }
} 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();
        int[] array = new int[n];
        for(int i=0; i<m; i++){
            int a = sc.nextInt();
            array[a] = 1;
        }

        int costMinus = 0;
        int costPlus = 0;

        for(int i=x; i>=0; i--){
            costMinus+=array[i];
        }

        for(int i=x; i<n; i++){
            costPlus+=array[i];
        }

        System.out.println(Math.min(costMinus, costPlus));
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int x = sc.nextInt();
        int[] array = new int[n];
        for(int i=0; i<m; i++){
            int a = sc.nextInt();
            array[a] = 1;
        }

        int costMinus = 0;
        int costPlus = 0;

        for(int i=x; i>=0; i--){
            costMinus+=array[i];
        }

        for(int i=x; i<n; i++){
            costPlus+=array[i];
        }

        System.out.println(Math.min(costMinus, costPlus));
    } 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 int[] array = new int[n]; array new int[n] n for(int i=0; i<m; i++){
            int a = sc.nextInt();
            array[a] = 1;
        } int i=0; int i=0; i 0 i<m i m i++ i++ i {
            int a = sc.nextInt();
            array[a] = 1;
        } {
            int a = sc.nextInt();
            array[a] = 1;
        } int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc array[a] = 1 array[a] array a 1 int costMinus = 0; costMinus 0 int costPlus = 0; costPlus 0 for(int i=x; i>=0; i--){
            costMinus+=array[i];
        } int i=x; int i=x; i x i>=0 i 0 i-- i-- i {
            costMinus+=array[i];
        } {
            costMinus+=array[i];
        } costMinus+=array[i] costMinus array[i] array i for(int i=x; i<n; i++){
            costPlus+=array[i];
        } int i=x; int i=x; i x i<n i n i++ i++ i {
            costPlus+=array[i];
        } {
            costPlus+=array[i];
        } costPlus+=array[i] costPlus array[i] array i System.out.println(Math.min(costMinus, costPlus)) System.out.println System.out System System.out Math.min(costMinus, costPlus) Math.min Math costMinus costPlus String[] args args public static void printArray(int[] array){
        for(int i=0; i<array.length; i++){
            if(i == array.length){
                System.out.println(array[i]);
            } else {
                System.out.print(String.format("%d ", array[i]));
            }
        }
    } printArray {
        for(int i=0; i<array.length; i++){
            if(i == array.length){
                System.out.println(array[i]);
            } else {
                System.out.print(String.format("%d ", array[i]));
            }
        }
    } for(int i=0; i<array.length; i++){
            if(i == array.length){
                System.out.println(array[i]);
            } else {
                System.out.print(String.format("%d ", array[i]));
            }
        } int i=0; int i=0; i 0 i<array.length i array.length array array.length i++ i++ i {
            if(i == array.length){
                System.out.println(array[i]);
            } else {
                System.out.print(String.format("%d ", array[i]));
            }
        } {
            if(i == array.length){
                System.out.println(array[i]);
            } else {
                System.out.print(String.format("%d ", array[i]));
            }
        } if(i == array.length){
                System.out.println(array[i]);
            } else {
                System.out.print(String.format("%d ", array[i]));
            } i == array.length i array.length array array.length {
                System.out.println(array[i]);
            } System.out.println(array[i]) System.out.println System.out System System.out array[i] array i {
                System.out.print(String.format("%d ", array[i]));
            } System.out.print(String.format("%d ", array[i])) System.out.print System.out System System.out String.format("%d ", array[i]) String.format String "%d " array[i] array i int[] array array public static int gcd(int a, int b){
        if (b == 0) return a;
        return gcd(b, a % b);
    } gcd {
        if (b == 0) return a;
        return gcd(b, a % b);
    } if (b == 0) return a; b == 0 b 0 return a; a return gcd(b, a % b); gcd(b, a % b) gcd b a % b a b int a a int b b public static int lcm(int a, int b){
        return a * b / gcd(a, b);
    } lcm {
        return a * b / gcd(a, b);
    } return a * b / gcd(a, b); a * b / gcd(a, b) a * b a b gcd(a, b) gcd a b int a a int b b public 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();
        int[] array = new int[n];
        for(int i=0; i<m; i++){
            int a = sc.nextInt();
            array[a] = 1;
        }

        int costMinus = 0;
        int costPlus = 0;

        for(int i=x; i>=0; i--){
            costMinus+=array[i];
        }

        for(int i=x; i<n; i++){
            costPlus+=array[i];
        }

        System.out.println(Math.min(costMinus, costPlus));
    }

    public static void printArray(int[] array){
        for(int i=0; i<array.length; i++){
            if(i == array.length){
                System.out.println(array[i]);
            } else {
                System.out.print(String.format("%d ", array[i]));
            }
        }
    }

    public static int gcd(int a, int b){
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    public static int lcm(int a, int b){
        return a * b / gcd(a, b);
    }
} public 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();
        int[] array = new int[n];
        for(int i=0; i<m; i++){
            int a = sc.nextInt();
            array[a] = 1;
        }

        int costMinus = 0;
        int costPlus = 0;

        for(int i=x; i>=0; i--){
            costMinus+=array[i];
        }

        for(int i=x; i<n; i++){
            costPlus+=array[i];
        }

        System.out.println(Math.min(costMinus, costPlus));
    }

    public static void printArray(int[] array){
        for(int i=0; i<array.length; i++){
            if(i == array.length){
                System.out.println(array[i]);
            } else {
                System.out.print(String.format("%d ", array[i]));
            }
        }
    }

    public static int gcd(int a, int b){
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    public static int lcm(int a, int b){
        return a * b / gcd(a, b);
    }
} Main
import java.util.*;

public 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();
        int[] array = new int[n];
        for(int i=0; i<m; i++){
            int a = sc.nextInt();
            array[a] = 1;
        }

        int costMinus = 0;
        int costPlus = 0;

        for(int i=x; i>=0; i--){
            costMinus+=array[i];
        }

        for(int i=x; i<n; i++){
            costPlus+=array[i];
        }

        System.out.println(Math.min(costMinus, costPlus));
    }

    public static void printArray(int[] array){
        for(int i=0; i<array.length; i++){
            if(i == array.length){
                System.out.println(array[i]);
            } else {
                System.out.print(String.format("%d ", array[i]));
            }
        }
    }

    public static int gcd(int a, int b){
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    public static int lcm(int a, int b){
        return a * b / gcd(a, b);
    }
}
