import java.util.*;

public 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 arr[] = new int[N+1];
    for(int i = 1; i<=M; i++){
      int n = sc.nextInt();
      arr[n] = 1;
    }
    int opt1 = 0; //cost of going from X to 0
    int opt2 = 0; //cost of going from X to N
    for(int i = X; i>=0; i--){
      opt1 += arr[i]; 
    }
    for(int i = X; i<=N; i++){
      opt2 += arr[i]; 
    }
    System.out.println(Math.min(opt1, opt2));
  }
}

/*

pre[i] = arr[1] + arr[2] + arr[3] + arr[4] + ... + arr[i]
The question for some l and r
arr[l] + arr[l+1] + arr[l+2] + ... + arr[r]
= 
pre[r] - pre[l-1]

pre[r]   = arr[1] + arr[2] + ... + arr[l-1] + arr[l] + arr[l+1] + ... + arr[r]
-
pre[l-1] = arr[1] + arr[2] + ... + arr[l-1]

*/ import java.util.*; util.* java public 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 arr[] = new int[N+1];
    for(int i = 1; i<=M; i++){
      int n = sc.nextInt();
      arr[n] = 1;
    }
    int opt1 = 0; //cost of going from X to 0
    int opt2 = 0; //cost of going from X to N
    for(int i = X; i>=0; i--){
      opt1 += arr[i]; 
    }
    for(int i = X; i<=N; i++){
      opt2 += arr[i]; 
    }
    System.out.println(Math.min(opt1, opt2));
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(), M = sc.nextInt(), X = sc.nextInt();
    int arr[] = new int[N+1];
    for(int i = 1; i<=M; i++){
      int n = sc.nextInt();
      arr[n] = 1;
    }
    int opt1 = 0; //cost of going from X to 0
    int opt2 = 0; //cost of going from X to N
    for(int i = X; i>=0; i--){
      opt1 += arr[i]; 
    }
    for(int i = X; i<=N; i++){
      opt2 += arr[i]; 
    }
    System.out.println(Math.min(opt1, opt2));
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(), M = sc.nextInt(), X = sc.nextInt();
    int arr[] = new int[N+1];
    for(int i = 1; i<=M; i++){
      int n = sc.nextInt();
      arr[n] = 1;
    }
    int opt1 = 0; //cost of going from X to 0
    int opt2 = 0; //cost of going from X to N
    for(int i = X; i>=0; i--){
      opt1 += arr[i]; 
    }
    for(int i = X; i<=N; i++){
      opt2 += arr[i]; 
    }
    System.out.println(Math.min(opt1, opt2));
  } 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 arr[] = new int[N+1]; arr new int[N+1] N+1 N 1 for(int i = 1; i<=M; i++){
      int n = sc.nextInt();
      arr[n] = 1;
    } int i = 1; int i = 1; i 1 i<=M i M i++ i++ i {
      int n = sc.nextInt();
      arr[n] = 1;
    } {
      int n = sc.nextInt();
      arr[n] = 1;
    } int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc arr[n] = 1 arr[n] arr n 1 int opt1 = 0; opt1 0 int opt2 = 0; opt2 0 for(int i = X; i>=0; i--){
      opt1 += arr[i]; 
    } int i = X; int i = X; i X i>=0 i 0 i-- i-- i {
      opt1 += arr[i]; 
    } {
      opt1 += arr[i]; 
    } opt1 += arr[i] opt1 arr[i] arr i for(int i = X; i<=N; i++){
      opt2 += arr[i]; 
    } int i = X; int i = X; i X i<=N i N i++ i++ i {
      opt2 += arr[i]; 
    } {
      opt2 += arr[i]; 
    } opt2 += arr[i] opt2 arr[i] arr i System.out.println(Math.min(opt1, opt2)) System.out.println System.out System System.out Math.min(opt1, opt2) Math.min Math opt1 opt2 String[] args args public 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 arr[] = new int[N+1];
    for(int i = 1; i<=M; i++){
      int n = sc.nextInt();
      arr[n] = 1;
    }
    int opt1 = 0; //cost of going from X to 0
    int opt2 = 0; //cost of going from X to N
    for(int i = X; i>=0; i--){
      opt1 += arr[i]; 
    }
    for(int i = X; i<=N; i++){
      opt2 += arr[i]; 
    }
    System.out.println(Math.min(opt1, opt2));
  }
} public 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 arr[] = new int[N+1];
    for(int i = 1; i<=M; i++){
      int n = sc.nextInt();
      arr[n] = 1;
    }
    int opt1 = 0; //cost of going from X to 0
    int opt2 = 0; //cost of going from X to N
    for(int i = X; i>=0; i--){
      opt1 += arr[i]; 
    }
    for(int i = X; i<=N; i++){
      opt2 += arr[i]; 
    }
    System.out.println(Math.min(opt1, opt2));
  }
} Main
import java.util.*;

public 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 arr[] = new int[N+1];
    for(int i = 1; i<=M; i++){
      int n = sc.nextInt();
      arr[n] = 1;
    }
    int opt1 = 0; //cost of going from X to 0
    int opt2 = 0; //cost of going from X to N
    for(int i = X; i>=0; i--){
      opt1 += arr[i]; 
    }
    for(int i = X; i<=N; i++){
      opt2 += arr[i]; 
    }
    System.out.println(Math.min(opt1, opt2));
  }
}

/*

pre[i] = arr[1] + arr[2] + arr[3] + arr[4] + ... + arr[i]
The question for some l and r
arr[l] + arr[l+1] + arr[l+2] + ... + arr[r]
= 
pre[r] - pre[l-1]

pre[r]   = arr[1] + arr[2] + ... + arr[l-1] + arr[l] + arr[l+1] + ... + arr[r]
-
pre[l-1] = arr[1] + arr[2] + ... + arr[l-1]

*/
