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 []a=new int [m];
    int j=0;
    int k=0;
    
    for (int i=0; i<a.length; i++){
      a[i]=sc.nextInt();
    }
    for (int i=0; i<a.length; i++){
      if(a[i]>x){j++;}
      if(a[i]<x){k++;}
    }
    if(j<=k){System.out.printf("%d\n", j);}
    else {System.out.printf("%d\n", k);}
  }
} 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 []a=new int [m];
    int j=0;
    int k=0;
    
    for (int i=0; i<a.length; i++){
      a[i]=sc.nextInt();
    }
    for (int i=0; i<a.length; i++){
      if(a[i]>x){j++;}
      if(a[i]<x){k++;}
    }
    if(j<=k){System.out.printf("%d\n", j);}
    else {System.out.printf("%d\n", k);}
  }
} 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];
    int j=0;
    int k=0;
    
    for (int i=0; i<a.length; i++){
      a[i]=sc.nextInt();
    }
    for (int i=0; i<a.length; i++){
      if(a[i]>x){j++;}
      if(a[i]<x){k++;}
    }
    if(j<=k){System.out.printf("%d\n", j);}
    else {System.out.printf("%d\n", k);}
  } main {
    Scanner sc=new Scanner (System.in);
    int n=sc.nextInt();
    int m=sc.nextInt();
    int x=sc.nextInt();
    int []a=new int [m];
    int j=0;
    int k=0;
    
    for (int i=0; i<a.length; i++){
      a[i]=sc.nextInt();
    }
    for (int i=0; i<a.length; i++){
      if(a[i]>x){j++;}
      if(a[i]<x){k++;}
    }
    if(j<=k){System.out.printf("%d\n", j);}
    else {System.out.printf("%d\n", k);}
  } 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 int j=0; j 0 int k=0; k 0 for (int i=0; i<a.length; i++){
      a[i]=sc.nextInt();
    } int i=0; int i=0; i 0 i<a.length i a.length a a.length i++ i++ i {
      a[i]=sc.nextInt();
    } {
      a[i]=sc.nextInt();
    } a[i]=sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc for (int i=0; i<a.length; i++){
      if(a[i]>x){j++;}
      if(a[i]<x){k++;}
    } int i=0; int i=0; i 0 i<a.length i a.length a a.length i++ i++ i {
      if(a[i]>x){j++;}
      if(a[i]<x){k++;}
    } {
      if(a[i]>x){j++;}
      if(a[i]<x){k++;}
    } if(a[i]>x){j++;} a[i]>x a[i] a i x {j++;} j++ j if(a[i]<x){k++;} a[i]<x a[i] a i x {k++;} k++ k if(j<=k){System.out.printf("%d\n", j);}
    else {System.out.printf("%d\n", k);} j<=k j k {System.out.printf("%d\n", j);} System.out.printf("%d\n", j) System.out.printf System.out System System.out "%d\n" j {System.out.printf("%d\n", k);} System.out.printf("%d\n", k) System.out.printf System.out System System.out "%d\n" k 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 []a=new int [m];
    int j=0;
    int k=0;
    
    for (int i=0; i<a.length; i++){
      a[i]=sc.nextInt();
    }
    for (int i=0; i<a.length; i++){
      if(a[i]>x){j++;}
      if(a[i]<x){k++;}
    }
    if(j<=k){System.out.printf("%d\n", j);}
    else {System.out.printf("%d\n", k);}
  }
} 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 []a=new int [m];
    int j=0;
    int k=0;
    
    for (int i=0; i<a.length; i++){
      a[i]=sc.nextInt();
    }
    for (int i=0; i<a.length; i++){
      if(a[i]>x){j++;}
      if(a[i]<x){k++;}
    }
    if(j<=k){System.out.printf("%d\n", j);}
    else {System.out.printf("%d\n", k);}
  }
} 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 []a=new int [m];
    int j=0;
    int k=0;
    
    for (int i=0; i<a.length; i++){
      a[i]=sc.nextInt();
    }
    for (int i=0; i<a.length; i++){
      if(a[i]>x){j++;}
      if(a[i]<x){k++;}
    }
    if(j<=k){System.out.printf("%d\n", j);}
    else {System.out.printf("%d\n", k);}
  }
}
