import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
  public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt()+1;  //道のり
    int M = sc.nextInt();    //料金所の数
    int X = sc.nextInt();    //スタート地点
    int[] place = new int[M]; //料金所の場所
    
    int PatternA = 0;
    int PatternB = 0;
    
    for(int i = 0 ; i < M ; i++){
      place[i] = sc.nextInt();
    }
    
    for(int i = X ; i < N ; i++){ //右側の料金所の数
      for(int j = 0 ; j < place.length ; j++){
        if(i == place[j]){
          PatternA++;
        }
      }
    }
    
    for(int i = X ; i >= 1 ; i--){
      for(int j = 0 ; j < place.length ; j ++){
        if(i == place[j]){
        PatternB++;
        }
      }
    }
    if(PatternA < PatternB){
      System.out.println(PatternA);
    }else{
      System.out.println(PatternB);
    }
  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io 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()+1;  //道のり
    int M = sc.nextInt();    //料金所の数
    int X = sc.nextInt();    //スタート地点
    int[] place = new int[M]; //料金所の場所
    
    int PatternA = 0;
    int PatternB = 0;
    
    for(int i = 0 ; i < M ; i++){
      place[i] = sc.nextInt();
    }
    
    for(int i = X ; i < N ; i++){ //右側の料金所の数
      for(int j = 0 ; j < place.length ; j++){
        if(i == place[j]){
          PatternA++;
        }
      }
    }
    
    for(int i = X ; i >= 1 ; i--){
      for(int j = 0 ; j < place.length ; j ++){
        if(i == place[j]){
        PatternB++;
        }
      }
    }
    if(PatternA < PatternB){
      System.out.println(PatternA);
    }else{
      System.out.println(PatternB);
    }
  }
} Main public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt()+1;  //道のり
    int M = sc.nextInt();    //料金所の数
    int X = sc.nextInt();    //スタート地点
    int[] place = new int[M]; //料金所の場所
    
    int PatternA = 0;
    int PatternB = 0;
    
    for(int i = 0 ; i < M ; i++){
      place[i] = sc.nextInt();
    }
    
    for(int i = X ; i < N ; i++){ //右側の料金所の数
      for(int j = 0 ; j < place.length ; j++){
        if(i == place[j]){
          PatternA++;
        }
      }
    }
    
    for(int i = X ; i >= 1 ; i--){
      for(int j = 0 ; j < place.length ; j ++){
        if(i == place[j]){
        PatternB++;
        }
      }
    }
    if(PatternA < PatternB){
      System.out.println(PatternA);
    }else{
      System.out.println(PatternB);
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt()+1;  //道のり
    int M = sc.nextInt();    //料金所の数
    int X = sc.nextInt();    //スタート地点
    int[] place = new int[M]; //料金所の場所
    
    int PatternA = 0;
    int PatternB = 0;
    
    for(int i = 0 ; i < M ; i++){
      place[i] = sc.nextInt();
    }
    
    for(int i = X ; i < N ; i++){ //右側の料金所の数
      for(int j = 0 ; j < place.length ; j++){
        if(i == place[j]){
          PatternA++;
        }
      }
    }
    
    for(int i = X ; i >= 1 ; i--){
      for(int j = 0 ; j < place.length ; j ++){
        if(i == place[j]){
        PatternB++;
        }
      }
    }
    if(PatternA < PatternB){
      System.out.println(PatternA);
    }else{
      System.out.println(PatternB);
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt()+1; N sc.nextInt()+1 sc.nextInt() sc.nextInt sc 1 int M = sc.nextInt(); M sc.nextInt() sc.nextInt sc int X = sc.nextInt(); X sc.nextInt() sc.nextInt sc int[] place = new int[M]; place new int[M] M int PatternA = 0; PatternA 0 int PatternB = 0; PatternB 0 for(int i = 0 ; i < M ; i++){
      place[i] = sc.nextInt();
    } int i = 0 ; int i = 0 ; i 0 i < M i M i++ i++ i {
      place[i] = sc.nextInt();
    } {
      place[i] = sc.nextInt();
    } place[i] = sc.nextInt() place[i] place i sc.nextInt() sc.nextInt sc for(int i = X ; i < N ; i++){ //右側の料金所の数
      for(int j = 0 ; j < place.length ; j++){
        if(i == place[j]){
          PatternA++;
        }
      }
    } int i = X ; int i = X ; i X i < N i N i++ i++ i { //右側の料金所の数
      for(int j = 0 ; j < place.length ; j++){
        if(i == place[j]){
          PatternA++;
        }
      }
    } { //右側の料金所の数
      for(int j = 0 ; j < place.length ; j++){
        if(i == place[j]){
          PatternA++;
        }
      }
    } for(int j = 0 ; j < place.length ; j++){
        if(i == place[j]){
          PatternA++;
        }
      } int j = 0 ; int j = 0 ; j 0 j < place.length j place.length place place.length j++ j++ j {
        if(i == place[j]){
          PatternA++;
        }
      } {
        if(i == place[j]){
          PatternA++;
        }
      } if(i == place[j]){
          PatternA++;
        } i == place[j] i place[j] place j {
          PatternA++;
        } PatternA++ PatternA for(int i = X ; i >= 1 ; i--){
      for(int j = 0 ; j < place.length ; j ++){
        if(i == place[j]){
        PatternB++;
        }
      }
    } int i = X ; int i = X ; i X i >= 1 i 1 i-- i-- i {
      for(int j = 0 ; j < place.length ; j ++){
        if(i == place[j]){
        PatternB++;
        }
      }
    } {
      for(int j = 0 ; j < place.length ; j ++){
        if(i == place[j]){
        PatternB++;
        }
      }
    } for(int j = 0 ; j < place.length ; j ++){
        if(i == place[j]){
        PatternB++;
        }
      } int j = 0 ; int j = 0 ; j 0 j < place.length j place.length place place.length j ++ j ++ j {
        if(i == place[j]){
        PatternB++;
        }
      } {
        if(i == place[j]){
        PatternB++;
        }
      } if(i == place[j]){
        PatternB++;
        } i == place[j] i place[j] place j {
        PatternB++;
        } PatternB++ PatternB if(PatternA < PatternB){
      System.out.println(PatternA);
    }else{
      System.out.println(PatternB);
    } PatternA < PatternB PatternA PatternB {
      System.out.println(PatternA);
    } System.out.println(PatternA) System.out.println System.out System System.out PatternA {
      System.out.println(PatternB);
    } System.out.println(PatternB) System.out.println System.out System System.out PatternB String[] args args public class Main {
  public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt()+1;  //道のり
    int M = sc.nextInt();    //料金所の数
    int X = sc.nextInt();    //スタート地点
    int[] place = new int[M]; //料金所の場所
    
    int PatternA = 0;
    int PatternB = 0;
    
    for(int i = 0 ; i < M ; i++){
      place[i] = sc.nextInt();
    }
    
    for(int i = X ; i < N ; i++){ //右側の料金所の数
      for(int j = 0 ; j < place.length ; j++){
        if(i == place[j]){
          PatternA++;
        }
      }
    }
    
    for(int i = X ; i >= 1 ; i--){
      for(int j = 0 ; j < place.length ; j ++){
        if(i == place[j]){
        PatternB++;
        }
      }
    }
    if(PatternA < PatternB){
      System.out.println(PatternA);
    }else{
      System.out.println(PatternB);
    }
  }
} public class Main {
  public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt()+1;  //道のり
    int M = sc.nextInt();    //料金所の数
    int X = sc.nextInt();    //スタート地点
    int[] place = new int[M]; //料金所の場所
    
    int PatternA = 0;
    int PatternB = 0;
    
    for(int i = 0 ; i < M ; i++){
      place[i] = sc.nextInt();
    }
    
    for(int i = X ; i < N ; i++){ //右側の料金所の数
      for(int j = 0 ; j < place.length ; j++){
        if(i == place[j]){
          PatternA++;
        }
      }
    }
    
    for(int i = X ; i >= 1 ; i--){
      for(int j = 0 ; j < place.length ; j ++){
        if(i == place[j]){
        PatternB++;
        }
      }
    }
    if(PatternA < PatternB){
      System.out.println(PatternA);
    }else{
      System.out.println(PatternB);
    }
  }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
  public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt()+1;  //道のり
    int M = sc.nextInt();    //料金所の数
    int X = sc.nextInt();    //スタート地点
    int[] place = new int[M]; //料金所の場所
    
    int PatternA = 0;
    int PatternB = 0;
    
    for(int i = 0 ; i < M ; i++){
      place[i] = sc.nextInt();
    }
    
    for(int i = X ; i < N ; i++){ //右側の料金所の数
      for(int j = 0 ; j < place.length ; j++){
        if(i == place[j]){
          PatternA++;
        }
      }
    }
    
    for(int i = X ; i >= 1 ; i--){
      for(int j = 0 ; j < place.length ; j ++){
        if(i == place[j]){
        PatternB++;
        }
      }
    }
    if(PatternA < PatternB){
      System.out.println(PatternA);
    }else{
      System.out.println(PatternB);
    }
  }
}