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

// ABC094 at 2018/04/14

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solveB();
    }

    private void solveA() {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int X = sc.nextInt();
        if ((X - A) < 0) {
            System.out.println("NO");
        } else if (B < (X - A)) {
            System.out.println("NO");
        } else if ((A + B) < X) {
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    }

    private void solveB() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        ArrayList <Integer> list = new ArrayList<>();
        for (int i = 0; i < M; i++) {
            list.add(sc.nextInt());
        }
        int cost1 = 0;
        for (int i = X; i < N + 1; i++) {
            if (list.contains(i)) {
                cost1++;
            }
        }
        int cost2 = 0;
        for (int i = X; 0 < i; i--) {
            if (list.contains(i)) {
                cost2++;
            }
        }
        if (cost1 < cost2) {
            System.out.println(cost1);
        } else {
            System.out.println(cost2);
        }
    }

    private void solveC() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveD() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveE() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveF() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solveB();
    }

    private void solveA() {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int X = sc.nextInt();
        if ((X - A) < 0) {
            System.out.println("NO");
        } else if (B < (X - A)) {
            System.out.println("NO");
        } else if ((A + B) < X) {
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    }

    private void solveB() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        ArrayList <Integer> list = new ArrayList<>();
        for (int i = 0; i < M; i++) {
            list.add(sc.nextInt());
        }
        int cost1 = 0;
        for (int i = X; i < N + 1; i++) {
            if (list.contains(i)) {
                cost1++;
            }
        }
        int cost2 = 0;
        for (int i = X; 0 < i; i--) {
            if (list.contains(i)) {
                cost2++;
            }
        }
        if (cost1 < cost2) {
            System.out.println(cost1);
        } else {
            System.out.println(cost2);
        }
    }

    private void solveC() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveD() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveE() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveF() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

} Main public static void main(String[] args) {
        Main main = new Main();
        main.solveB();
    } main {
        Main main = new Main();
        main.solveB();
    } Main main = new Main(); main new Main() main.solveB() main.solveB main String[] args args private void solveA() {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int X = sc.nextInt();
        if ((X - A) < 0) {
            System.out.println("NO");
        } else if (B < (X - A)) {
            System.out.println("NO");
        } else if ((A + B) < X) {
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    } solveA {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int X = sc.nextInt();
        if ((X - A) < 0) {
            System.out.println("NO");
        } else if (B < (X - A)) {
            System.out.println("NO");
        } else if ((A + B) < X) {
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int A = sc.nextInt(); A sc.nextInt() sc.nextInt sc int B = sc.nextInt(); B sc.nextInt() sc.nextInt sc int X = sc.nextInt(); X sc.nextInt() sc.nextInt sc if ((X - A) < 0) {
            System.out.println("NO");
        } else if (B < (X - A)) {
            System.out.println("NO");
        } else if ((A + B) < X) {
            System.out.println("NO");
        } else {
            System.out.println("YES");
        } (X - A) < 0 (X - A) X A 0 {
            System.out.println("NO");
        } System.out.println("NO") System.out.println System.out System System.out "NO" if (B < (X - A)) {
            System.out.println("NO");
        } else if ((A + B) < X) {
            System.out.println("NO");
        } else {
            System.out.println("YES");
        } B < (X - A) B (X - A) X A {
            System.out.println("NO");
        } System.out.println("NO") System.out.println System.out System System.out "NO" if ((A + B) < X) {
            System.out.println("NO");
        } else {
            System.out.println("YES");
        } (A + B) < X (A + B) A B X {
            System.out.println("NO");
        } System.out.println("NO") System.out.println System.out System System.out "NO" {
            System.out.println("YES");
        } System.out.println("YES") System.out.println System.out System System.out "YES" private void solveB() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        ArrayList <Integer> list = new ArrayList<>();
        for (int i = 0; i < M; i++) {
            list.add(sc.nextInt());
        }
        int cost1 = 0;
        for (int i = X; i < N + 1; i++) {
            if (list.contains(i)) {
                cost1++;
            }
        }
        int cost2 = 0;
        for (int i = X; 0 < i; i--) {
            if (list.contains(i)) {
                cost2++;
            }
        }
        if (cost1 < cost2) {
            System.out.println(cost1);
        } else {
            System.out.println(cost2);
        }
    } solveB {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        ArrayList <Integer> list = new ArrayList<>();
        for (int i = 0; i < M; i++) {
            list.add(sc.nextInt());
        }
        int cost1 = 0;
        for (int i = X; i < N + 1; i++) {
            if (list.contains(i)) {
                cost1++;
            }
        }
        int cost2 = 0;
        for (int i = X; 0 < i; i--) {
            if (list.contains(i)) {
                cost2++;
            }
        }
        if (cost1 < cost2) {
            System.out.println(cost1);
        } else {
            System.out.println(cost2);
        }
    } 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 ArrayList <Integer> list = new ArrayList<>(); list new ArrayList<>() for (int i = 0; i < M; i++) {
            list.add(sc.nextInt());
        } int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
            list.add(sc.nextInt());
        } {
            list.add(sc.nextInt());
        } list.add(sc.nextInt()) list.add list sc.nextInt() sc.nextInt sc int cost1 = 0; cost1 0 for (int i = X; i < N + 1; i++) {
            if (list.contains(i)) {
                cost1++;
            }
        } int i = X; int i = X; i X i < N + 1 i N + 1 N 1 i++ i++ i {
            if (list.contains(i)) {
                cost1++;
            }
        } {
            if (list.contains(i)) {
                cost1++;
            }
        } if (list.contains(i)) {
                cost1++;
            } list.contains(i) list.contains list i {
                cost1++;
            } cost1++ cost1 int cost2 = 0; cost2 0 for (int i = X; 0 < i; i--) {
            if (list.contains(i)) {
                cost2++;
            }
        } int i = X; int i = X; i X 0 < i 0 i i-- i-- i {
            if (list.contains(i)) {
                cost2++;
            }
        } {
            if (list.contains(i)) {
                cost2++;
            }
        } if (list.contains(i)) {
                cost2++;
            } list.contains(i) list.contains list i {
                cost2++;
            } cost2++ cost2 if (cost1 < cost2) {
            System.out.println(cost1);
        } else {
            System.out.println(cost2);
        } cost1 < cost2 cost1 cost2 {
            System.out.println(cost1);
        } System.out.println(cost1) System.out.println System.out System System.out cost1 {
            System.out.println(cost2);
        } System.out.println(cost2) System.out.println System.out System System.out cost2 private void solveC() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    } solveC {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc System.out.println(N) System.out.println System.out System System.out N private void solveD() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    } solveD {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc System.out.println(N) System.out.println System.out System System.out N private void solveE() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    } solveE {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc System.out.println(N) System.out.println System.out System System.out N private void solveF() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    } solveF {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc System.out.println(N) System.out.println System.out System System.out N public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solveB();
    }

    private void solveA() {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int X = sc.nextInt();
        if ((X - A) < 0) {
            System.out.println("NO");
        } else if (B < (X - A)) {
            System.out.println("NO");
        } else if ((A + B) < X) {
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    }

    private void solveB() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        ArrayList <Integer> list = new ArrayList<>();
        for (int i = 0; i < M; i++) {
            list.add(sc.nextInt());
        }
        int cost1 = 0;
        for (int i = X; i < N + 1; i++) {
            if (list.contains(i)) {
                cost1++;
            }
        }
        int cost2 = 0;
        for (int i = X; 0 < i; i--) {
            if (list.contains(i)) {
                cost2++;
            }
        }
        if (cost1 < cost2) {
            System.out.println(cost1);
        } else {
            System.out.println(cost2);
        }
    }

    private void solveC() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveD() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveE() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveF() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

} public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solveB();
    }

    private void solveA() {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int X = sc.nextInt();
        if ((X - A) < 0) {
            System.out.println("NO");
        } else if (B < (X - A)) {
            System.out.println("NO");
        } else if ((A + B) < X) {
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    }

    private void solveB() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        ArrayList <Integer> list = new ArrayList<>();
        for (int i = 0; i < M; i++) {
            list.add(sc.nextInt());
        }
        int cost1 = 0;
        for (int i = X; i < N + 1; i++) {
            if (list.contains(i)) {
                cost1++;
            }
        }
        int cost2 = 0;
        for (int i = X; 0 < i; i--) {
            if (list.contains(i)) {
                cost2++;
            }
        }
        if (cost1 < cost2) {
            System.out.println(cost1);
        } else {
            System.out.println(cost2);
        }
    }

    private void solveC() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveD() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveE() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveF() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

} Main

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

// ABC094 at 2018/04/14

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solveB();
    }

    private void solveA() {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int X = sc.nextInt();
        if ((X - A) < 0) {
            System.out.println("NO");
        } else if (B < (X - A)) {
            System.out.println("NO");
        } else if ((A + B) < X) {
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    }

    private void solveB() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        ArrayList <Integer> list = new ArrayList<>();
        for (int i = 0; i < M; i++) {
            list.add(sc.nextInt());
        }
        int cost1 = 0;
        for (int i = X; i < N + 1; i++) {
            if (list.contains(i)) {
                cost1++;
            }
        }
        int cost2 = 0;
        for (int i = X; 0 < i; i--) {
            if (list.contains(i)) {
                cost2++;
            }
        }
        if (cost1 < cost2) {
            System.out.println(cost1);
        } else {
            System.out.println(cost2);
        }
    }

    private void solveC() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveD() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveE() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveF() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

}