import java.util.*;

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();
    int a[] = new int [m];
    for(int i = 0;i < m;i++){
      a[i] = sc.nextInt();
    }
    int count1 = 0;
    int count2 = 0;
    for(int i = x;i < n+1;i++){
      for(int j = 0;j < m;j++){
        if(i == a[j]){
          count1++;
        }
      }
    }
    for(int i = x;i != n;i--){
      for(int j = 0;j < m;j++){
        if(i == a[j]){
          count2++;
        }
        if(i == 0){
          i = n + 1;
        }
      }
    }
    if(count1 < count2){
      System.out.println(count1);
    }else{
      System.out.println(count2);
    }
  }
} import java.util.*; util.* java 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();
    int a[] = new int [m];
    for(int i = 0;i < m;i++){
      a[i] = sc.nextInt();
    }
    int count1 = 0;
    int count2 = 0;
    for(int i = x;i < n+1;i++){
      for(int j = 0;j < m;j++){
        if(i == a[j]){
          count1++;
        }
      }
    }
    for(int i = x;i != n;i--){
      for(int j = 0;j < m;j++){
        if(i == a[j]){
          count2++;
        }
        if(i == 0){
          i = n + 1;
        }
      }
    }
    if(count1 < count2){
      System.out.println(count1);
    }else{
      System.out.println(count2);
    }
  }
} 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();
    int a[] = new int [m];
    for(int i = 0;i < m;i++){
      a[i] = sc.nextInt();
    }
    int count1 = 0;
    int count2 = 0;
    for(int i = x;i < n+1;i++){
      for(int j = 0;j < m;j++){
        if(i == a[j]){
          count1++;
        }
      }
    }
    for(int i = x;i != n;i--){
      for(int j = 0;j < m;j++){
        if(i == a[j]){
          count2++;
        }
        if(i == 0){
          i = n + 1;
        }
      }
    }
    if(count1 < count2){
      System.out.println(count1);
    }else{
      System.out.println(count2);
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int x = sc.nextInt();
    int a[] = new int [m];
    for(int i = 0;i < m;i++){
      a[i] = sc.nextInt();
    }
    int count1 = 0;
    int count2 = 0;
    for(int i = x;i < n+1;i++){
      for(int j = 0;j < m;j++){
        if(i == a[j]){
          count1++;
        }
      }
    }
    for(int i = x;i != n;i--){
      for(int j = 0;j < m;j++){
        if(i == a[j]){
          count2++;
        }
        if(i == 0){
          i = n + 1;
        }
      }
    }
    if(count1 < count2){
      System.out.println(count1);
    }else{
      System.out.println(count2);
    }
  } 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 [m]; a new int [m] m for(int i = 0;i < m;i++){
      a[i] = sc.nextInt();
    } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
      a[i] = sc.nextInt();
    } {
      a[i] = sc.nextInt();
    } a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc int count1 = 0; count1 0 int count2 = 0; count2 0 for(int i = x;i < n+1;i++){
      for(int j = 0;j < m;j++){
        if(i == a[j]){
          count1++;
        }
      }
    } int i = x; int i = x; i x i < n+1 i n+1 n 1 i++ i++ i {
      for(int j = 0;j < m;j++){
        if(i == a[j]){
          count1++;
        }
      }
    } {
      for(int j = 0;j < m;j++){
        if(i == a[j]){
          count1++;
        }
      }
    } for(int j = 0;j < m;j++){
        if(i == a[j]){
          count1++;
        }
      } int j = 0; int j = 0; j 0 j < m j m j++ j++ j {
        if(i == a[j]){
          count1++;
        }
      } {
        if(i == a[j]){
          count1++;
        }
      } if(i == a[j]){
          count1++;
        } i == a[j] i a[j] a j {
          count1++;
        } count1++ count1 for(int i = x;i != n;i--){
      for(int j = 0;j < m;j++){
        if(i == a[j]){
          count2++;
        }
        if(i == 0){
          i = n + 1;
        }
      }
    } int i = x; int i = x; i x i != n i n i-- i-- i {
      for(int j = 0;j < m;j++){
        if(i == a[j]){
          count2++;
        }
        if(i == 0){
          i = n + 1;
        }
      }
    } {
      for(int j = 0;j < m;j++){
        if(i == a[j]){
          count2++;
        }
        if(i == 0){
          i = n + 1;
        }
      }
    } for(int j = 0;j < m;j++){
        if(i == a[j]){
          count2++;
        }
        if(i == 0){
          i = n + 1;
        }
      } int j = 0; int j = 0; j 0 j < m j m j++ j++ j {
        if(i == a[j]){
          count2++;
        }
        if(i == 0){
          i = n + 1;
        }
      } {
        if(i == a[j]){
          count2++;
        }
        if(i == 0){
          i = n + 1;
        }
      } if(i == a[j]){
          count2++;
        } i == a[j] i a[j] a j {
          count2++;
        } count2++ count2 if(i == 0){
          i = n + 1;
        } i == 0 i 0 {
          i = n + 1;
        } i = n + 1 i n + 1 n 1 if(count1 < count2){
      System.out.println(count1);
    }else{
      System.out.println(count2);
    } count1 < count2 count1 count2 {
      System.out.println(count1);
    } System.out.println(count1) System.out.println System.out System System.out count1 {
      System.out.println(count2);
    } System.out.println(count2) System.out.println System.out System System.out count2 String args[] args
import java.util.*;

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();
    int a[] = new int [m];
    for(int i = 0;i < m;i++){
      a[i] = sc.nextInt();
    }
    int count1 = 0;
    int count2 = 0;
    for(int i = x;i < n+1;i++){
      for(int j = 0;j < m;j++){
        if(i == a[j]){
          count1++;
        }
      }
    }
    for(int i = x;i != n;i--){
      for(int j = 0;j < m;j++){
        if(i == a[j]){
          count2++;
        }
        if(i == 0){
          i = n + 1;
        }
      }
    }
    if(count1 < count2){
      System.out.println(count1);
    }else{
      System.out.println(count2);
    }
  }
}