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[n+1];
    for(int i=0;i<m;i++){
      a[sc.nextInt()]=1;
    }
    for(int i=0;i<n;i++){
      a[i+1]+=a[i];
    }
    System.out.println(Math.min(a[x],a[n]-a[x]));
  }
} 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[n+1];
    for(int i=0;i<m;i++){
      a[sc.nextInt()]=1;
    }
    for(int i=0;i<n;i++){
      a[i+1]+=a[i];
    }
    System.out.println(Math.min(a[x],a[n]-a[x]));
  }
} 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[n+1];
    for(int i=0;i<m;i++){
      a[sc.nextInt()]=1;
    }
    for(int i=0;i<n;i++){
      a[i+1]+=a[i];
    }
    System.out.println(Math.min(a[x],a[n]-a[x]));
  } 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=0;i<m;i++){
      a[sc.nextInt()]=1;
    }
    for(int i=0;i<n;i++){
      a[i+1]+=a[i];
    }
    System.out.println(Math.min(a[x],a[n]-a[x]));
  } 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=0;i<m;i++){
      a[sc.nextInt()]=1;
    } int i=0; int i=0; i 0 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 for(int i=0;i<n;i++){
      a[i+1]+=a[i];
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      a[i+1]+=a[i];
    } {
      a[i+1]+=a[i];
    } a[i+1]+=a[i] a[i+1] a i+1 i 1 a[i] a i System.out.println(Math.min(a[x],a[n]-a[x])) System.out.println System.out System System.out Math.min(a[x],a[n]-a[x]) Math.min Math a[x] a x a[n]-a[x] a[n] a n a[x] a x 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[n+1];
    for(int i=0;i<m;i++){
      a[sc.nextInt()]=1;
    }
    for(int i=0;i<n;i++){
      a[i+1]+=a[i];
    }
    System.out.println(Math.min(a[x],a[n]-a[x]));
  }
}