import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int x = Integer.parseInt(sc.next());
        int[] ary = new int[n];
        int st = 0;
        int gl = 0;

        for (int i = 0; i < m; i++) {
            int y = Integer.parseInt(sc.next());
            ary[y] = 1;
        }
        for (int i = x; i < n; i++) {
            gl += ary[i];
        }
        for (int i = x; 0 < i; i--) {
            st += ary[i];
        }
        System.out.println(Math.min(st,gl));
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int x = Integer.parseInt(sc.next());
        int[] ary = new int[n];
        int st = 0;
        int gl = 0;

        for (int i = 0; i < m; i++) {
            int y = Integer.parseInt(sc.next());
            ary[y] = 1;
        }
        for (int i = x; i < n; i++) {
            gl += ary[i];
        }
        for (int i = x; 0 < i; i--) {
            st += ary[i];
        }
        System.out.println(Math.min(st,gl));
    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int x = Integer.parseInt(sc.next());
        int[] ary = new int[n];
        int st = 0;
        int gl = 0;

        for (int i = 0; i < m; i++) {
            int y = Integer.parseInt(sc.next());
            ary[y] = 1;
        }
        for (int i = x; i < n; i++) {
            gl += ary[i];
        }
        for (int i = x; 0 < i; i--) {
            st += ary[i];
        }
        System.out.println(Math.min(st,gl));
    } main {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int x = Integer.parseInt(sc.next());
        int[] ary = new int[n];
        int st = 0;
        int gl = 0;

        for (int i = 0; i < m; i++) {
            int y = Integer.parseInt(sc.next());
            ary[y] = 1;
        }
        for (int i = x; i < n; i++) {
            gl += ary[i];
        }
        for (int i = x; 0 < i; i--) {
            st += ary[i];
        }
        System.out.println(Math.min(st,gl));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int m = Integer.parseInt(sc.next()); m Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int x = Integer.parseInt(sc.next()); x Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] ary = new int[n]; ary new int[n] n int st = 0; st 0 int gl = 0; gl 0 for (int i = 0; i < m; i++) {
            int y = Integer.parseInt(sc.next());
            ary[y] = 1;
        } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
            int y = Integer.parseInt(sc.next());
            ary[y] = 1;
        } {
            int y = Integer.parseInt(sc.next());
            ary[y] = 1;
        } int y = Integer.parseInt(sc.next()); y Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc ary[y] = 1 ary[y] ary y 1 for (int i = x; i < n; i++) {
            gl += ary[i];
        } int i = x; int i = x; i x i < n i n i++ i++ i {
            gl += ary[i];
        } {
            gl += ary[i];
        } gl += ary[i] gl ary[i] ary i for (int i = x; 0 < i; i--) {
            st += ary[i];
        } int i = x; int i = x; i x 0 < i 0 i i-- i-- i {
            st += ary[i];
        } {
            st += ary[i];
        } st += ary[i] st ary[i] ary i System.out.println(Math.min(st,gl)) System.out.println System.out System System.out Math.min(st,gl) Math.min Math st gl String[] args args public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int x = Integer.parseInt(sc.next());
        int[] ary = new int[n];
        int st = 0;
        int gl = 0;

        for (int i = 0; i < m; i++) {
            int y = Integer.parseInt(sc.next());
            ary[y] = 1;
        }
        for (int i = x; i < n; i++) {
            gl += ary[i];
        }
        for (int i = x; 0 < i; i--) {
            st += ary[i];
        }
        System.out.println(Math.min(st,gl));
    }
} public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int x = Integer.parseInt(sc.next());
        int[] ary = new int[n];
        int st = 0;
        int gl = 0;

        for (int i = 0; i < m; i++) {
            int y = Integer.parseInt(sc.next());
            ary[y] = 1;
        }
        for (int i = x; i < n; i++) {
            gl += ary[i];
        }
        for (int i = x; 0 < i; i--) {
            st += ary[i];
        }
        System.out.println(Math.min(st,gl));
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int x = Integer.parseInt(sc.next());
        int[] ary = new int[n];
        int st = 0;
        int gl = 0;

        for (int i = 0; i < m; i++) {
            int y = Integer.parseInt(sc.next());
            ary[y] = 1;
        }
        for (int i = x; i < n; i++) {
            gl += ary[i];
        }
        for (int i = x; 0 < i; i--) {
            st += ary[i];
        }
        System.out.println(Math.min(st,gl));
    }
}
