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[] a = new int[m];
        Set<Integer> set = new HashSet<>();

        for (int i = 0; i < m; i++) {
            set.add(sc.nextInt());
        }
        
        int cost1 = 0;
        for (int i = x; i <= n; i++) {
            if (set.contains(i)) cost1++;
        }

        int cost2 = 0;
        for (int i = x; i >= 0; i--) {
            if (set.contains(i)) cost2++;
        }

        System.out.println(Math.min(cost1, cost2));
        
    }
} 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[] a = new int[m];
        Set<Integer> set = new HashSet<>();

        for (int i = 0; i < m; i++) {
            set.add(sc.nextInt());
        }
        
        int cost1 = 0;
        for (int i = x; i <= n; i++) {
            if (set.contains(i)) cost1++;
        }

        int cost2 = 0;
        for (int i = x; i >= 0; i--) {
            if (set.contains(i)) cost2++;
        }

        System.out.println(Math.min(cost1, cost2));
        
    }
} 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[] a = new int[m];
        Set<Integer> set = new HashSet<>();

        for (int i = 0; i < m; i++) {
            set.add(sc.nextInt());
        }
        
        int cost1 = 0;
        for (int i = x; i <= n; i++) {
            if (set.contains(i)) cost1++;
        }

        int cost2 = 0;
        for (int i = x; i >= 0; i--) {
            if (set.contains(i)) cost2++;
        }

        System.out.println(Math.min(cost1, cost2));
        
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int x = sc.nextInt();
        int[] a = new int[m];
        Set<Integer> set = new HashSet<>();

        for (int i = 0; i < m; i++) {
            set.add(sc.nextInt());
        }
        
        int cost1 = 0;
        for (int i = x; i <= n; i++) {
            if (set.contains(i)) cost1++;
        }

        int cost2 = 0;
        for (int i = x; i >= 0; i--) {
            if (set.contains(i)) cost2++;
        }

        System.out.println(Math.min(cost1, 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 int[] a = new int[m]; a new int[m] m Set<Integer> set = new HashSet<>(); set new HashSet<>() for (int i = 0; i < m; i++) {
            set.add(sc.nextInt());
        } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
            set.add(sc.nextInt());
        } {
            set.add(sc.nextInt());
        } set.add(sc.nextInt()) set.add set sc.nextInt() sc.nextInt sc int cost1 = 0; cost1 0 for (int i = x; i <= n; i++) {
            if (set.contains(i)) cost1++;
        } int i = x; int i = x; i x i <= n i n i++ i++ i {
            if (set.contains(i)) cost1++;
        } {
            if (set.contains(i)) cost1++;
        } if (set.contains(i)) cost1++; set.contains(i) set.contains set i cost1++ cost1 int cost2 = 0; cost2 0 for (int i = x; i >= 0; i--) {
            if (set.contains(i)) cost2++;
        } int i = x; int i = x; i x i >= 0 i 0 i-- i-- i {
            if (set.contains(i)) cost2++;
        } {
            if (set.contains(i)) cost2++;
        } if (set.contains(i)) cost2++; set.contains(i) set.contains set i cost2++ cost2 System.out.println(Math.min(cost1, cost2)) System.out.println System.out System System.out Math.min(cost1, cost2) Math.min Math cost1 cost2 String[] args args 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[] a = new int[m];
        Set<Integer> set = new HashSet<>();

        for (int i = 0; i < m; i++) {
            set.add(sc.nextInt());
        }
        
        int cost1 = 0;
        for (int i = x; i <= n; i++) {
            if (set.contains(i)) cost1++;
        }

        int cost2 = 0;
        for (int i = x; i >= 0; i--) {
            if (set.contains(i)) cost2++;
        }

        System.out.println(Math.min(cost1, cost2));
        
    }
} 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[] a = new int[m];
        Set<Integer> set = new HashSet<>();

        for (int i = 0; i < m; i++) {
            set.add(sc.nextInt());
        }
        
        int cost1 = 0;
        for (int i = x; i <= n; i++) {
            if (set.contains(i)) cost1++;
        }

        int cost2 = 0;
        for (int i = x; i >= 0; i--) {
            if (set.contains(i)) cost2++;
        }

        System.out.println(Math.min(cost1, cost2));
        
    }
} 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[] a = new int[m];
        Set<Integer> set = new HashSet<>();

        for (int i = 0; i < m; i++) {
            set.add(sc.nextInt());
        }
        
        int cost1 = 0;
        for (int i = x; i <= n; i++) {
            if (set.contains(i)) cost1++;
        }

        int cost2 = 0;
        for (int i = x; i >= 0; i--) {
            if (set.contains(i)) cost2++;
        }

        System.out.println(Math.min(cost1, cost2));
        
    }
}