import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = in.nextInt();
        int m = in.nextInt();
        int x = in.nextInt();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < m; i++){
            int k = in.nextInt();
            list.add(k);
        }
        int cost_left = 0;
        for (int i = x; i >= 0; i--){
            if (list.contains(i)) cost_left++;
        }
        int cost_rigth = 0;
        for (int i = x; i <= n; i++){
            if (list.contains(i)) cost_rigth++;
        }
        System.out.println(Math.min(cost_left, cost_rigth));
    }

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.*; util.* java public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = in.nextInt();
        int m = in.nextInt();
        int x = in.nextInt();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < m; i++){
            int k = in.nextInt();
            list.add(k);
        }
        int cost_left = 0;
        for (int i = x; i >= 0; i--){
            if (list.contains(i)) cost_left++;
        }
        int cost_rigth = 0;
        for (int i = x; i <= n; i++){
            if (list.contains(i)) cost_rigth++;
        }
        System.out.println(Math.min(cost_left, cost_rigth));
    }

} Main public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = in.nextInt();
        int m = in.nextInt();
        int x = in.nextInt();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < m; i++){
            int k = in.nextInt();
            list.add(k);
        }
        int cost_left = 0;
        for (int i = x; i >= 0; i--){
            if (list.contains(i)) cost_left++;
        }
        int cost_rigth = 0;
        for (int i = x; i <= n; i++){
            if (list.contains(i)) cost_rigth++;
        }
        System.out.println(Math.min(cost_left, cost_rigth));
    } main {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = in.nextInt();
        int m = in.nextInt();
        int x = in.nextInt();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < m; i++){
            int k = in.nextInt();
            list.add(k);
        }
        int cost_left = 0;
        for (int i = x; i >= 0; i--){
            if (list.contains(i)) cost_left++;
        }
        int cost_rigth = 0;
        for (int i = x; i <= n; i++){
            if (list.contains(i)) cost_rigth++;
        }
        System.out.println(Math.min(cost_left, cost_rigth));
    } Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); in new Scanner(new BufferedReader(new InputStreamReader(System.in))) int n = in.nextInt(); n in.nextInt() in.nextInt in int m = in.nextInt(); m in.nextInt() in.nextInt in int x = in.nextInt(); x in.nextInt() in.nextInt in List<Integer> list = new ArrayList<>(); list new ArrayList<>() for (int i = 0; i < m; i++){
            int k = in.nextInt();
            list.add(k);
        } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
            int k = in.nextInt();
            list.add(k);
        } {
            int k = in.nextInt();
            list.add(k);
        } int k = in.nextInt(); k in.nextInt() in.nextInt in list.add(k) list.add list k int cost_left = 0; cost_left 0 for (int i = x; i >= 0; i--){
            if (list.contains(i)) cost_left++;
        } int i = x; int i = x; i x i >= 0 i 0 i-- i-- i {
            if (list.contains(i)) cost_left++;
        } {
            if (list.contains(i)) cost_left++;
        } if (list.contains(i)) cost_left++; list.contains(i) list.contains list i cost_left++ cost_left int cost_rigth = 0; cost_rigth 0 for (int i = x; i <= n; i++){
            if (list.contains(i)) cost_rigth++;
        } int i = x; int i = x; i x i <= n i n i++ i++ i {
            if (list.contains(i)) cost_rigth++;
        } {
            if (list.contains(i)) cost_rigth++;
        } if (list.contains(i)) cost_rigth++; list.contains(i) list.contains list i cost_rigth++ cost_rigth System.out.println(Math.min(cost_left, cost_rigth)) System.out.println System.out System System.out Math.min(cost_left, cost_rigth) Math.min Math cost_left cost_rigth String[] args args public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = in.nextInt();
        int m = in.nextInt();
        int x = in.nextInt();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < m; i++){
            int k = in.nextInt();
            list.add(k);
        }
        int cost_left = 0;
        for (int i = x; i >= 0; i--){
            if (list.contains(i)) cost_left++;
        }
        int cost_rigth = 0;
        for (int i = x; i <= n; i++){
            if (list.contains(i)) cost_rigth++;
        }
        System.out.println(Math.min(cost_left, cost_rigth));
    }

} public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = in.nextInt();
        int m = in.nextInt();
        int x = in.nextInt();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < m; i++){
            int k = in.nextInt();
            list.add(k);
        }
        int cost_left = 0;
        for (int i = x; i >= 0; i--){
            if (list.contains(i)) cost_left++;
        }
        int cost_rigth = 0;
        for (int i = x; i <= n; i++){
            if (list.contains(i)) cost_rigth++;
        }
        System.out.println(Math.min(cost_left, cost_rigth));
    }

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = in.nextInt();
        int m = in.nextInt();
        int x = in.nextInt();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < m; i++){
            int k = in.nextInt();
            list.add(k);
        }
        int cost_left = 0;
        for (int i = x; i >= 0; i--){
            if (list.contains(i)) cost_left++;
        }
        int cost_rigth = 0;
        for (int i = x; i <= n; i++){
            if (list.contains(i)) cost_rigth++;
        }
        System.out.println(Math.min(cost_left, cost_rigth));
    }

}