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 = new int[m];
    for(int i = 0; i < m; i++){
      a[i] = sc.nextInt();
    }
    int num = ~Arrays.binarySearch(a, x);
    System.out.println(Math.min(num, m - num));
  }
} 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 = new int[m];
    for(int i = 0; i < m; i++){
      a[i] = sc.nextInt();
    }
    int num = ~Arrays.binarySearch(a, x);
    System.out.println(Math.min(num, m - num));
  }
} 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];
    for(int i = 0; i < m; i++){
      a[i] = sc.nextInt();
    }
    int num = ~Arrays.binarySearch(a, x);
    System.out.println(Math.min(num, m - num));
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int x = sc.nextInt();
    int[] a = new int[m];
    for(int i = 0; i < m; i++){
      a[i] = sc.nextInt();
    }
    int num = ~Arrays.binarySearch(a, x);
    System.out.println(Math.min(num, m - num));
  } 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 for(int i = 0; i < m; i++){
      a[i] = sc.nextInt();
    } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
      a[i] = sc.nextInt();
    } {
      a[i] = sc.nextInt();
    } a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc int num = ~Arrays.binarySearch(a, x); num ~Arrays.binarySearch(a, x) Arrays.binarySearch(a, x) Arrays.binarySearch Arrays a x System.out.println(Math.min(num, m - num)) System.out.println System.out System System.out Math.min(num, m - num) Math.min Math num m - num m num 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];
    for(int i = 0; i < m; i++){
      a[i] = sc.nextInt();
    }
    int num = ~Arrays.binarySearch(a, x);
    System.out.println(Math.min(num, m - num));
  }
} 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];
    for(int i = 0; i < m; i++){
      a[i] = sc.nextInt();
    }
    int num = ~Arrays.binarySearch(a, x);
    System.out.println(Math.min(num, m - num));
  }
} 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 = new int[m];
    for(int i = 0; i < m; i++){
      a[i] = sc.nextInt();
    }
    int num = ~Arrays.binarySearch(a, x);
    System.out.println(Math.min(num, m - num));
  }
}