import java.util.Scanner;
 
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();
   int[] Narray = new int[N+1];
  int to0 =0;
  int toN =0;
  for(int i=0;i<M;i++){
 int tmp = sc.nextInt(); 
    Narray[tmp]=1;
  }  
  for(int i=0;i<X;i++){
  to0 += Narray[i];
  }
   for(int i=N;i>X;i--){
  toN += Narray[i];
  }
  if(to0>toN)
    System.out.print(toN);
  else
    System.out.print(to0);
}
} import java.util.Scanner; Scanner 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();
   int[] Narray = new int[N+1];
  int to0 =0;
  int toN =0;
  for(int i=0;i<M;i++){
 int tmp = sc.nextInt(); 
    Narray[tmp]=1;
  }  
  for(int i=0;i<X;i++){
  to0 += Narray[i];
  }
   for(int i=N;i>X;i--){
  toN += Narray[i];
  }
  if(to0>toN)
    System.out.print(toN);
  else
    System.out.print(to0);
}
} 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[] Narray = new int[N+1];
  int to0 =0;
  int toN =0;
  for(int i=0;i<M;i++){
 int tmp = sc.nextInt(); 
    Narray[tmp]=1;
  }  
  for(int i=0;i<X;i++){
  to0 += Narray[i];
  }
   for(int i=N;i>X;i--){
  toN += Narray[i];
  }
  if(to0>toN)
    System.out.print(toN);
  else
    System.out.print(to0);
} main {
Scanner sc = new Scanner(System.in);
  int N = sc.nextInt();
  int M = sc.nextInt();
  int X = sc.nextInt();
   int[] Narray = new int[N+1];
  int to0 =0;
  int toN =0;
  for(int i=0;i<M;i++){
 int tmp = sc.nextInt(); 
    Narray[tmp]=1;
  }  
  for(int i=0;i<X;i++){
  to0 += Narray[i];
  }
   for(int i=N;i>X;i--){
  toN += Narray[i];
  }
  if(to0>toN)
    System.out.print(toN);
  else
    System.out.print(to0);
} 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[] Narray = new int[N+1]; Narray new int[N+1] N+1 N 1 int to0 =0; to0 0 int toN =0; toN 0 for(int i=0;i<M;i++){
 int tmp = sc.nextInt(); 
    Narray[tmp]=1;
  } int i=0; int i=0; i 0 i<M i M i++ i++ i {
 int tmp = sc.nextInt(); 
    Narray[tmp]=1;
  } {
 int tmp = sc.nextInt(); 
    Narray[tmp]=1;
  } int tmp = sc.nextInt(); tmp sc.nextInt() sc.nextInt sc Narray[tmp]=1 Narray[tmp] Narray tmp 1 for(int i=0;i<X;i++){
  to0 += Narray[i];
  } int i=0; int i=0; i 0 i<X i X i++ i++ i {
  to0 += Narray[i];
  } {
  to0 += Narray[i];
  } to0 += Narray[i] to0 Narray[i] Narray i for(int i=N;i>X;i--){
  toN += Narray[i];
  } int i=N; int i=N; i N i>X i X i-- i-- i {
  toN += Narray[i];
  } {
  toN += Narray[i];
  } toN += Narray[i] toN Narray[i] Narray i if(to0>toN)
    System.out.print(toN);
  else
    System.out.print(to0); to0>toN to0 toN System.out.print(toN) System.out.print System.out System System.out toN System.out.print(to0) System.out.print System.out System System.out to0 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();
   int[] Narray = new int[N+1];
  int to0 =0;
  int toN =0;
  for(int i=0;i<M;i++){
 int tmp = sc.nextInt(); 
    Narray[tmp]=1;
  }  
  for(int i=0;i<X;i++){
  to0 += Narray[i];
  }
   for(int i=N;i>X;i--){
  toN += Narray[i];
  }
  if(to0>toN)
    System.out.print(toN);
  else
    System.out.print(to0);
}
} 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();
   int[] Narray = new int[N+1];
  int to0 =0;
  int toN =0;
  for(int i=0;i<M;i++){
 int tmp = sc.nextInt(); 
    Narray[tmp]=1;
  }  
  for(int i=0;i<X;i++){
  to0 += Narray[i];
  }
   for(int i=N;i>X;i--){
  toN += Narray[i];
  }
  if(to0>toN)
    System.out.print(toN);
  else
    System.out.print(to0);
}
} Main
import java.util.Scanner;
 
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();
   int[] Narray = new int[N+1];
  int to0 =0;
  int toN =0;
  for(int i=0;i<M;i++){
 int tmp = sc.nextInt(); 
    Narray[tmp]=1;
  }  
  for(int i=0;i<X;i++){
  to0 += Narray[i];
  }
   for(int i=N;i>X;i--){
  toN += Narray[i];
  }
  if(to0>toN)
    System.out.print(toN);
  else
    System.out.print(to0);
}
}