
import java.util.*;
import java.util.ArrayList;
import java.util.List;

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();
    

    List list = new ArrayList<>();
    for(int i = 0; i < m; i++){
      list.add(sc.nextInt());
    }

    int countA = 0;
    for(int i = x; i < n; i++){
      if(list.contains(i)){
        countA++;
      }
    }
    
    int countB = 0;
    for(int i = x; i > 0; i--){
      if(list.contains(i)){
        countB++;
      }
    }
    System.out.println(countA < countB ? countA : countB);
  }
} import java.util.*; util.* java import java.util.ArrayList; ArrayList java.util import java.util.List; List 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();
    

    List list = new ArrayList<>();
    for(int i = 0; i < m; i++){
      list.add(sc.nextInt());
    }

    int countA = 0;
    for(int i = x; i < n; i++){
      if(list.contains(i)){
        countA++;
      }
    }
    
    int countB = 0;
    for(int i = x; i > 0; i--){
      if(list.contains(i)){
        countB++;
      }
    }
    System.out.println(countA < countB ? countA : countB);
  }
} 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();
    

    List list = new ArrayList<>();
    for(int i = 0; i < m; i++){
      list.add(sc.nextInt());
    }

    int countA = 0;
    for(int i = x; i < n; i++){
      if(list.contains(i)){
        countA++;
      }
    }
    
    int countB = 0;
    for(int i = x; i > 0; i--){
      if(list.contains(i)){
        countB++;
      }
    }
    System.out.println(countA < countB ? countA : countB);
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int x = sc.nextInt();
    

    List list = new ArrayList<>();
    for(int i = 0; i < m; i++){
      list.add(sc.nextInt());
    }

    int countA = 0;
    for(int i = x; i < n; i++){
      if(list.contains(i)){
        countA++;
      }
    }
    
    int countB = 0;
    for(int i = x; i > 0; i--){
      if(list.contains(i)){
        countB++;
      }
    }
    System.out.println(countA < countB ? countA : countB);
  } 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 List list = new ArrayList<>(); list new ArrayList<>() for(int i = 0; i < m; i++){
      list.add(sc.nextInt());
    } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
      list.add(sc.nextInt());
    } {
      list.add(sc.nextInt());
    } list.add(sc.nextInt()) list.add list sc.nextInt() sc.nextInt sc int countA = 0; countA 0 for(int i = x; i < n; i++){
      if(list.contains(i)){
        countA++;
      }
    } int i = x; int i = x; i x i < n i n i++ i++ i {
      if(list.contains(i)){
        countA++;
      }
    } {
      if(list.contains(i)){
        countA++;
      }
    } if(list.contains(i)){
        countA++;
      } list.contains(i) list.contains list i {
        countA++;
      } countA++ countA int countB = 0; countB 0 for(int i = x; i > 0; i--){
      if(list.contains(i)){
        countB++;
      }
    } int i = x; int i = x; i x i > 0 i 0 i-- i-- i {
      if(list.contains(i)){
        countB++;
      }
    } {
      if(list.contains(i)){
        countB++;
      }
    } if(list.contains(i)){
        countB++;
      } list.contains(i) list.contains list i {
        countB++;
      } countB++ countB System.out.println(countA < countB ? countA : countB) System.out.println System.out System System.out countA < countB ? countA : countB countA < countB countA countB countA countB 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();
    

    List list = new ArrayList<>();
    for(int i = 0; i < m; i++){
      list.add(sc.nextInt());
    }

    int countA = 0;
    for(int i = x; i < n; i++){
      if(list.contains(i)){
        countA++;
      }
    }
    
    int countB = 0;
    for(int i = x; i > 0; i--){
      if(list.contains(i)){
        countB++;
      }
    }
    System.out.println(countA < countB ? countA : countB);
  }
} 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();
    

    List list = new ArrayList<>();
    for(int i = 0; i < m; i++){
      list.add(sc.nextInt());
    }

    int countA = 0;
    for(int i = x; i < n; i++){
      if(list.contains(i)){
        countA++;
      }
    }
    
    int countB = 0;
    for(int i = x; i > 0; i--){
      if(list.contains(i)){
        countB++;
      }
    }
    System.out.println(countA < countB ? countA : countB);
  }
} Main

import java.util.*;
import java.util.ArrayList;
import java.util.List;

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();
    

    List list = new ArrayList<>();
    for(int i = 0; i < m; i++){
      list.add(sc.nextInt());
    }

    int countA = 0;
    for(int i = x; i < n; i++){
      if(list.contains(i)){
        countA++;
      }
    }
    
    int countB = 0;
    for(int i = x; i > 0; i--){
      if(list.contains(i)){
        countB++;
      }
    }
    System.out.println(countA < countB ? countA : countB);
  }
}