import  java.util.*;
class Main {
    public static void main(String[] args){

        Scanner sc =new Scanner(System.in);
        int n=sc.nextInt(),m=sc.nextInt(),x=sc.nextInt();
        int[] a =new int[1000];
        for(int i=0;i<m;i++)a[sc.nextInt()]++;
        long ans1 =0,ans2=0;
        for(int i=x-1;i>0;--i){
            if(a[i]>0)
                ans1++;
        }
        for (int i=x+1;i<n;i++){
            if(a[i]>0)ans2++;
        }
        System.out.println(Math.min(ans1,ans2));
    }
} import  java.util.*; util.* java class Main {
    public static void main(String[] args){

        Scanner sc =new Scanner(System.in);
        int n=sc.nextInt(),m=sc.nextInt(),x=sc.nextInt();
        int[] a =new int[1000];
        for(int i=0;i<m;i++)a[sc.nextInt()]++;
        long ans1 =0,ans2=0;
        for(int i=x-1;i>0;--i){
            if(a[i]>0)
                ans1++;
        }
        for (int i=x+1;i<n;i++){
            if(a[i]>0)ans2++;
        }
        System.out.println(Math.min(ans1,ans2));
    }
} Main public static void main(String[] args){

        Scanner sc =new Scanner(System.in);
        int n=sc.nextInt(),m=sc.nextInt(),x=sc.nextInt();
        int[] a =new int[1000];
        for(int i=0;i<m;i++)a[sc.nextInt()]++;
        long ans1 =0,ans2=0;
        for(int i=x-1;i>0;--i){
            if(a[i]>0)
                ans1++;
        }
        for (int i=x+1;i<n;i++){
            if(a[i]>0)ans2++;
        }
        System.out.println(Math.min(ans1,ans2));
    } main {

        Scanner sc =new Scanner(System.in);
        int n=sc.nextInt(),m=sc.nextInt(),x=sc.nextInt();
        int[] a =new int[1000];
        for(int i=0;i<m;i++)a[sc.nextInt()]++;
        long ans1 =0,ans2=0;
        for(int i=x-1;i>0;--i){
            if(a[i]>0)
                ans1++;
        }
        for (int i=x+1;i<n;i++){
            if(a[i]>0)ans2++;
        }
        System.out.println(Math.min(ans1,ans2));
    } Scanner sc =new Scanner(System.in); sc new Scanner(System.in) int n=sc.nextInt() n sc.nextInt() sc.nextInt sc m=sc.nextInt() m sc.nextInt() sc.nextInt sc x=sc.nextInt(); x sc.nextInt() sc.nextInt sc int[] a =new int[1000]; a new int[1000] 1000 for(int i=0;i<m;i++)a[sc.nextInt()]++; int i=0; int i=0; i 0 i<m i m i++ i++ i a[sc.nextInt()]++; a[sc.nextInt()]++ a[sc.nextInt()] a sc.nextInt() sc.nextInt sc long ans1 =0 ans1 0 ans2=0; ans2 0 for(int i=x-1;i>0;--i){
            if(a[i]>0)
                ans1++;
        } int i=x-1; int i=x-1; i x-1 x 1 i>0 i 0 --i --i i {
            if(a[i]>0)
                ans1++;
        } {
            if(a[i]>0)
                ans1++;
        } if(a[i]>0)
                ans1++; a[i]>0 a[i] a i 0 ans1++ ans1 for (int i=x+1;i<n;i++){
            if(a[i]>0)ans2++;
        } int i=x+1; int i=x+1; i x+1 x 1 i<n i n i++ i++ i {
            if(a[i]>0)ans2++;
        } {
            if(a[i]>0)ans2++;
        } if(a[i]>0)ans2++; a[i]>0 a[i] a i 0 ans2++ ans2 System.out.println(Math.min(ans1,ans2)) System.out.println System.out System System.out Math.min(ans1,ans2) Math.min Math ans1 ans2 String[] args args
import  java.util.*;
class Main {
    public static void main(String[] args){

        Scanner sc =new Scanner(System.in);
        int n=sc.nextInt(),m=sc.nextInt(),x=sc.nextInt();
        int[] a =new int[1000];
        for(int i=0;i<m;i++)a[sc.nextInt()]++;
        long ans1 =0,ans2=0;
        for(int i=x-1;i>0;--i){
            if(a[i]>0)
                ans1++;
        }
        for (int i=x+1;i<n;i++){
            if(a[i]>0)ans2++;
        }
        System.out.println(Math.min(ans1,ans2));
    }
}