import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        
        int A[] = new int[N+1];
        for(int i = 1; i <= M; i++) {
            A[sc.nextInt()] = 1;
        }
        
        int min = Integer.MAX_VALUE;
        
        int right = 0;
        for(int i = X; i <= N; i++) {
            if( A[i] > 0 ) {
                right++;
            }
        }
        min = Math.min(min, right);
        
        int left = 0;
        for(int i = X; 0 <= i; i--) {
            if( A[i] > 0 ) {
                left++;
            }
        }
        min = Math.min(min, left);
        
        System.out.println( min );
        
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        
        int A[] = new int[N+1];
        for(int i = 1; i <= M; i++) {
            A[sc.nextInt()] = 1;
        }
        
        int min = Integer.MAX_VALUE;
        
        int right = 0;
        for(int i = X; i <= N; i++) {
            if( A[i] > 0 ) {
                right++;
            }
        }
        min = Math.min(min, right);
        
        int left = 0;
        for(int i = X; 0 <= i; i--) {
            if( A[i] > 0 ) {
                left++;
            }
        }
        min = Math.min(min, left);
        
        System.out.println( min );
        
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        
        int A[] = new int[N+1];
        for(int i = 1; i <= M; i++) {
            A[sc.nextInt()] = 1;
        }
        
        int min = Integer.MAX_VALUE;
        
        int right = 0;
        for(int i = X; i <= N; i++) {
            if( A[i] > 0 ) {
                right++;
            }
        }
        min = Math.min(min, right);
        
        int left = 0;
        for(int i = X; 0 <= i; i--) {
            if( A[i] > 0 ) {
                left++;
            }
        }
        min = Math.min(min, left);
        
        System.out.println( min );
        
    } main {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        
        int A[] = new int[N+1];
        for(int i = 1; i <= M; i++) {
            A[sc.nextInt()] = 1;
        }
        
        int min = Integer.MAX_VALUE;
        
        int right = 0;
        for(int i = X; i <= N; i++) {
            if( A[i] > 0 ) {
                right++;
            }
        }
        min = Math.min(min, right);
        
        int left = 0;
        for(int i = X; 0 <= i; i--) {
            if( A[i] > 0 ) {
                left++;
            }
        }
        min = Math.min(min, left);
        
        System.out.println( min );
        
    } 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[N+1]; A new int[N+1] N+1 N 1 for(int i = 1; i <= M; i++) {
            A[sc.nextInt()] = 1;
        } int i = 1; int i = 1; i 1 i <= M i M i++ i++ i {
            A[sc.nextInt()] = 1;
        } {
            A[sc.nextInt()] = 1;
        } A[sc.nextInt()] = 1 A[sc.nextInt()] A sc.nextInt() sc.nextInt sc 1 int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE int right = 0; right 0 for(int i = X; i <= N; i++) {
            if( A[i] > 0 ) {
                right++;
            }
        } int i = X; int i = X; i X i <= N i N i++ i++ i {
            if( A[i] > 0 ) {
                right++;
            }
        } {
            if( A[i] > 0 ) {
                right++;
            }
        } if( A[i] > 0 ) {
                right++;
            } A[i] > 0 A[i] A i 0 {
                right++;
            } right++ right min = Math.min(min, right) min Math.min(min, right) Math.min Math min right int left = 0; left 0 for(int i = X; 0 <= i; i--) {
            if( A[i] > 0 ) {
                left++;
            }
        } int i = X; int i = X; i X 0 <= i 0 i i-- i-- i {
            if( A[i] > 0 ) {
                left++;
            }
        } {
            if( A[i] > 0 ) {
                left++;
            }
        } if( A[i] > 0 ) {
                left++;
            } A[i] > 0 A[i] A i 0 {
                left++;
            } left++ left min = Math.min(min, left) min Math.min(min, left) Math.min Math min left System.out.println( min ) System.out.println System.out System System.out min String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        
        int A[] = new int[N+1];
        for(int i = 1; i <= M; i++) {
            A[sc.nextInt()] = 1;
        }
        
        int min = Integer.MAX_VALUE;
        
        int right = 0;
        for(int i = X; i <= N; i++) {
            if( A[i] > 0 ) {
                right++;
            }
        }
        min = Math.min(min, right);
        
        int left = 0;
        for(int i = X; 0 <= i; i--) {
            if( A[i] > 0 ) {
                left++;
            }
        }
        min = Math.min(min, left);
        
        System.out.println( min );
        
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        
        int A[] = new int[N+1];
        for(int i = 1; i <= M; i++) {
            A[sc.nextInt()] = 1;
        }
        
        int min = Integer.MAX_VALUE;
        
        int right = 0;
        for(int i = X; i <= N; i++) {
            if( A[i] > 0 ) {
                right++;
            }
        }
        min = Math.min(min, right);
        
        int left = 0;
        for(int i = X; 0 <= i; i--) {
            if( A[i] > 0 ) {
                left++;
            }
        }
        min = Math.min(min, left);
        
        System.out.println( min );
        
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        
        int A[] = new int[N+1];
        for(int i = 1; i <= M; i++) {
            A[sc.nextInt()] = 1;
        }
        
        int min = Integer.MAX_VALUE;
        
        int right = 0;
        for(int i = X; i <= N; i++) {
            if( A[i] > 0 ) {
                right++;
            }
        }
        min = Math.min(min, right);
        
        int left = 0;
        for(int i = X; 0 <= i; i--) {
            if( A[i] > 0 ) {
                left++;
            }
        }
        min = Math.min(min, left);
        
        System.out.println( min );
        
    }
}
