import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n, m, x;
    n = sc.nextInt();
    m = sc.nextInt();
    x = sc.nextInt();

    int start = 0;
    int fin = 0;
    for (int i = 0; i < m; i++) {
      int num = sc.nextInt();
      if (num < x) {
        start++;
      } else if (num > x) {
        fin++;
      }
    }
    System.out.println(Math.min(start, fin));
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n, m, x;
    n = sc.nextInt();
    m = sc.nextInt();
    x = sc.nextInt();

    int start = 0;
    int fin = 0;
    for (int i = 0; i < m; i++) {
      int num = sc.nextInt();
      if (num < x) {
        start++;
      } else if (num > x) {
        fin++;
      }
    }
    System.out.println(Math.min(start, fin));
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n, m, x;
    n = sc.nextInt();
    m = sc.nextInt();
    x = sc.nextInt();

    int start = 0;
    int fin = 0;
    for (int i = 0; i < m; i++) {
      int num = sc.nextInt();
      if (num < x) {
        start++;
      } else if (num > x) {
        fin++;
      }
    }
    System.out.println(Math.min(start, fin));
  } main {
    Scanner sc = new Scanner(System.in);
    int n, m, x;
    n = sc.nextInt();
    m = sc.nextInt();
    x = sc.nextInt();

    int start = 0;
    int fin = 0;
    for (int i = 0; i < m; i++) {
      int num = sc.nextInt();
      if (num < x) {
        start++;
      } else if (num > x) {
        fin++;
      }
    }
    System.out.println(Math.min(start, fin));
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n n m m x; x n = sc.nextInt() n sc.nextInt() sc.nextInt sc m = sc.nextInt() m sc.nextInt() sc.nextInt sc x = sc.nextInt() x sc.nextInt() sc.nextInt sc int start = 0; start 0 int fin = 0; fin 0 for (int i = 0; i < m; i++) {
      int num = sc.nextInt();
      if (num < x) {
        start++;
      } else if (num > x) {
        fin++;
      }
    } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
      int num = sc.nextInt();
      if (num < x) {
        start++;
      } else if (num > x) {
        fin++;
      }
    } {
      int num = sc.nextInt();
      if (num < x) {
        start++;
      } else if (num > x) {
        fin++;
      }
    } int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc if (num < x) {
        start++;
      } else if (num > x) {
        fin++;
      } num < x num x {
        start++;
      } start++ start if (num > x) {
        fin++;
      } num > x num x {
        fin++;
      } fin++ fin System.out.println(Math.min(start, fin)) System.out.println System.out System System.out Math.min(start, fin) Math.min Math start fin String[] args args public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n, m, x;
    n = sc.nextInt();
    m = sc.nextInt();
    x = sc.nextInt();

    int start = 0;
    int fin = 0;
    for (int i = 0; i < m; i++) {
      int num = sc.nextInt();
      if (num < x) {
        start++;
      } else if (num > x) {
        fin++;
      }
    }
    System.out.println(Math.min(start, fin));
  }
} public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n, m, x;
    n = sc.nextInt();
    m = sc.nextInt();
    x = sc.nextInt();

    int start = 0;
    int fin = 0;
    for (int i = 0; i < m; i++) {
      int num = sc.nextInt();
      if (num < x) {
        start++;
      } else if (num > x) {
        fin++;
      }
    }
    System.out.println(Math.min(start, fin));
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n, m, x;
    n = sc.nextInt();
    m = sc.nextInt();
    x = sc.nextInt();

    int start = 0;
    int fin = 0;
    for (int i = 0; i < m; i++) {
      int num = sc.nextInt();
      if (num < x) {
        start++;
      } else if (num > x) {
        fin++;
      }
    }
    System.out.println(Math.min(start, fin));
  }
}
