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();
        boolean[] a = new boolean[n+1];
        for(int i = 0;i<m;i++){
            a[sc.nextInt()]=true;
        }
        int ans0 = 0;
        int ansN = 0;
        for(int i = x;i<=n;i++){
            if(a[i]){
                ansN ++;
            }
        }
        for(int i =x;i>=0;i--){
            if(a[i]){
                ans0 ++;
            }
        }
        System.out.println(Math.min(ansN,ans0));
    }
} 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();
        boolean[] a = new boolean[n+1];
        for(int i = 0;i<m;i++){
            a[sc.nextInt()]=true;
        }
        int ans0 = 0;
        int ansN = 0;
        for(int i = x;i<=n;i++){
            if(a[i]){
                ansN ++;
            }
        }
        for(int i =x;i>=0;i--){
            if(a[i]){
                ans0 ++;
            }
        }
        System.out.println(Math.min(ansN,ans0));
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),m=sc.nextInt(),x=sc.nextInt();
        boolean[] a = new boolean[n+1];
        for(int i = 0;i<m;i++){
            a[sc.nextInt()]=true;
        }
        int ans0 = 0;
        int ansN = 0;
        for(int i = x;i<=n;i++){
            if(a[i]){
                ansN ++;
            }
        }
        for(int i =x;i>=0;i--){
            if(a[i]){
                ans0 ++;
            }
        }
        System.out.println(Math.min(ansN,ans0));
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),m=sc.nextInt(),x=sc.nextInt();
        boolean[] a = new boolean[n+1];
        for(int i = 0;i<m;i++){
            a[sc.nextInt()]=true;
        }
        int ans0 = 0;
        int ansN = 0;
        for(int i = x;i<=n;i++){
            if(a[i]){
                ansN ++;
            }
        }
        for(int i =x;i>=0;i--){
            if(a[i]){
                ans0 ++;
            }
        }
        System.out.println(Math.min(ansN,ans0));
    } 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 boolean[] a = new boolean[n+1]; a new boolean[n+1] n+1 n 1 for(int i = 0;i<m;i++){
            a[sc.nextInt()]=true;
        } int i = 0; int i = 0; i 0 i<m i m i++ i++ i {
            a[sc.nextInt()]=true;
        } {
            a[sc.nextInt()]=true;
        } a[sc.nextInt()]=true a[sc.nextInt()] a sc.nextInt() sc.nextInt sc true int ans0 = 0; ans0 0 int ansN = 0; ansN 0 for(int i = x;i<=n;i++){
            if(a[i]){
                ansN ++;
            }
        } int i = x; int i = x; i x i<=n i n i++ i++ i {
            if(a[i]){
                ansN ++;
            }
        } {
            if(a[i]){
                ansN ++;
            }
        } if(a[i]){
                ansN ++;
            } a[i] a i {
                ansN ++;
            } ansN ++ ansN for(int i =x;i>=0;i--){
            if(a[i]){
                ans0 ++;
            }
        } int i =x; int i =x; i x i>=0 i 0 i-- i-- i {
            if(a[i]){
                ans0 ++;
            }
        } {
            if(a[i]){
                ans0 ++;
            }
        } if(a[i]){
                ans0 ++;
            } a[i] a i {
                ans0 ++;
            } ans0 ++ ans0 System.out.println(Math.min(ansN,ans0)) System.out.println System.out System System.out Math.min(ansN,ans0) Math.min Math ansN ans0 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();
        boolean[] a = new boolean[n+1];
        for(int i = 0;i<m;i++){
            a[sc.nextInt()]=true;
        }
        int ans0 = 0;
        int ansN = 0;
        for(int i = x;i<=n;i++){
            if(a[i]){
                ansN ++;
            }
        }
        for(int i =x;i>=0;i--){
            if(a[i]){
                ans0 ++;
            }
        }
        System.out.println(Math.min(ansN,ans0));
    }
}