import 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;
      a = new int[m];
      for (int i = 0; i < m ; i++) {
         int s = sc.nextInt();
         a[i] = s;
      }
 
      int costl = 0;
      int i = 0;
 
      while (a[i] < x) {
         costl ++;
         i ++;
      }
 
      int costr = m - i;
 
      if (costl <= costr) {
          System.out.println(costl);
      }
      else {
          System.out.println(costr);
      }
   }
} import java.util.*; util.* java 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;
      a = new int[m];
      for (int i = 0; i < m ; i++) {
         int s = sc.nextInt();
         a[i] = s;
      }
 
      int costl = 0;
      int i = 0;
 
      while (a[i] < x) {
         costl ++;
         i ++;
      }
 
      int costr = m - i;
 
      if (costl <= costr) {
          System.out.println(costl);
      }
      else {
          System.out.println(costr);
      }
   }
} 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;
      a = new int[m];
      for (int i = 0; i < m ; i++) {
         int s = sc.nextInt();
         a[i] = s;
      }
 
      int costl = 0;
      int i = 0;
 
      while (a[i] < x) {
         costl ++;
         i ++;
      }
 
      int costr = m - i;
 
      if (costl <= costr) {
          System.out.println(costl);
      }
      else {
          System.out.println(costr);
      }
   } main {
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int m = sc.nextInt();
      int x = sc.nextInt();
 
      int[] a;
      a = new int[m];
      for (int i = 0; i < m ; i++) {
         int s = sc.nextInt();
         a[i] = s;
      }
 
      int costl = 0;
      int i = 0;
 
      while (a[i] < x) {
         costl ++;
         i ++;
      }
 
      int costr = m - i;
 
      if (costl <= costr) {
          System.out.println(costl);
      }
      else {
          System.out.println(costr);
      }
   } 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; a a = new int[m] a new int[m] m for (int i = 0; i < m ; i++) {
         int s = sc.nextInt();
         a[i] = s;
      } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
         int s = sc.nextInt();
         a[i] = s;
      } {
         int s = sc.nextInt();
         a[i] = s;
      } int s = sc.nextInt(); s sc.nextInt() sc.nextInt sc a[i] = s a[i] a i s int costl = 0; costl 0 int i = 0; i 0 while (a[i] < x) {
         costl ++;
         i ++;
      } a[i] < x a[i] a i x {
         costl ++;
         i ++;
      } costl ++ costl i ++ i int costr = m - i; costr m - i m i if (costl <= costr) {
          System.out.println(costl);
      }
      else {
          System.out.println(costr);
      } costl <= costr costl costr {
          System.out.println(costl);
      } System.out.println(costl) System.out.println System.out System System.out costl {
          System.out.println(costr);
      } System.out.println(costr) System.out.println System.out System System.out costr 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;
      a = new int[m];
      for (int i = 0; i < m ; i++) {
         int s = sc.nextInt();
         a[i] = s;
      }
 
      int costl = 0;
      int i = 0;
 
      while (a[i] < x) {
         costl ++;
         i ++;
      }
 
      int costr = m - i;
 
      if (costl <= costr) {
          System.out.println(costl);
      }
      else {
          System.out.println(costr);
      }
   }
} 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;
      a = new int[m];
      for (int i = 0; i < m ; i++) {
         int s = sc.nextInt();
         a[i] = s;
      }
 
      int costl = 0;
      int i = 0;
 
      while (a[i] < x) {
         costl ++;
         i ++;
      }
 
      int costr = m - i;
 
      if (costl <= costr) {
          System.out.println(costl);
      }
      else {
          System.out.println(costr);
      }
   }
} Main
import 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;
      a = new int[m];
      for (int i = 0; i < m ; i++) {
         int s = sc.nextInt();
         a[i] = s;
      }
 
      int costl = 0;
      int i = 0;
 
      while (a[i] < x) {
         costl ++;
         i ++;
      }
 
      int costr = m - i;
 
      if (costl <= costr) {
          System.out.println(costl);
      }
      else {
          System.out.println(costr);
      }
   }
}