

import java.io.*;
import java.util.*;
class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s[]=br.readLine().split(" ");
		int  n =Integer.parseInt(s[0]);
		int  m =Integer.parseInt(s[1]);
		int  x =Integer.parseInt(s[2]);
		int arr[] = new int[m];
		String s1[] = br.readLine().split(" ");
		for (int i = 0; i < s1.length; i++) {
			arr[i]=Integer.parseInt(s1[i]);
		}
		/*int res=0;
		int left = 0;
		int right = m-1;
		if(x > arr[m-1] || x< arr[0]) {
			System.out.println(0);
			
		}
		else {
		while(left<right) {
			int mid = (left+right)/2;
			//System.out.println("mid"+mid);
			if(arr[mid] < x) {
				res = mid;
				left = mid+1;
			}
			else {
				right = mid-1;
			}
		}
		if(arr[m-1] == n) {
			System.out.println(Math.min(res+1, m-res-2));
		}
		else
		System.out.println(Math.min(res+1, m-res-1));
		}*/
		int res=0;
		for (int i = 0; i < arr.length; i++) {
			if(arr[i]<x) {
				res++;
			}
			else {
				break;
			}
		}
		System.out.println(Math.min(res, m-res));
	}

} import java.io.*; io.* java import java.util.*; util.* java class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s[]=br.readLine().split(" ");
		int  n =Integer.parseInt(s[0]);
		int  m =Integer.parseInt(s[1]);
		int  x =Integer.parseInt(s[2]);
		int arr[] = new int[m];
		String s1[] = br.readLine().split(" ");
		for (int i = 0; i < s1.length; i++) {
			arr[i]=Integer.parseInt(s1[i]);
		}
		/*int res=0;
		int left = 0;
		int right = m-1;
		if(x > arr[m-1] || x< arr[0]) {
			System.out.println(0);
			
		}
		else {
		while(left<right) {
			int mid = (left+right)/2;
			//System.out.println("mid"+mid);
			if(arr[mid] < x) {
				res = mid;
				left = mid+1;
			}
			else {
				right = mid-1;
			}
		}
		if(arr[m-1] == n) {
			System.out.println(Math.min(res+1, m-res-2));
		}
		else
		System.out.println(Math.min(res+1, m-res-1));
		}*/
		int res=0;
		for (int i = 0; i < arr.length; i++) {
			if(arr[i]<x) {
				res++;
			}
			else {
				break;
			}
		}
		System.out.println(Math.min(res, m-res));
	}

} Main public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s[]=br.readLine().split(" ");
		int  n =Integer.parseInt(s[0]);
		int  m =Integer.parseInt(s[1]);
		int  x =Integer.parseInt(s[2]);
		int arr[] = new int[m];
		String s1[] = br.readLine().split(" ");
		for (int i = 0; i < s1.length; i++) {
			arr[i]=Integer.parseInt(s1[i]);
		}
		/*int res=0;
		int left = 0;
		int right = m-1;
		if(x > arr[m-1] || x< arr[0]) {
			System.out.println(0);
			
		}
		else {
		while(left<right) {
			int mid = (left+right)/2;
			//System.out.println("mid"+mid);
			if(arr[mid] < x) {
				res = mid;
				left = mid+1;
			}
			else {
				right = mid-1;
			}
		}
		if(arr[m-1] == n) {
			System.out.println(Math.min(res+1, m-res-2));
		}
		else
		System.out.println(Math.min(res+1, m-res-1));
		}*/
		int res=0;
		for (int i = 0; i < arr.length; i++) {
			if(arr[i]<x) {
				res++;
			}
			else {
				break;
			}
		}
		System.out.println(Math.min(res, m-res));
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s[]=br.readLine().split(" ");
		int  n =Integer.parseInt(s[0]);
		int  m =Integer.parseInt(s[1]);
		int  x =Integer.parseInt(s[2]);
		int arr[] = new int[m];
		String s1[] = br.readLine().split(" ");
		for (int i = 0; i < s1.length; i++) {
			arr[i]=Integer.parseInt(s1[i]);
		}
		/*int res=0;
		int left = 0;
		int right = m-1;
		if(x > arr[m-1] || x< arr[0]) {
			System.out.println(0);
			
		}
		else {
		while(left<right) {
			int mid = (left+right)/2;
			//System.out.println("mid"+mid);
			if(arr[mid] < x) {
				res = mid;
				left = mid+1;
			}
			else {
				right = mid-1;
			}
		}
		if(arr[m-1] == n) {
			System.out.println(Math.min(res+1, m-res-2));
		}
		else
		System.out.println(Math.min(res+1, m-res-1));
		}*/
		int res=0;
		for (int i = 0; i < arr.length; i++) {
			if(arr[i]<x) {
				res++;
			}
			else {
				break;
			}
		}
		System.out.println(Math.min(res, m-res));
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String s[]=br.readLine().split(" "); s br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int  n =Integer.parseInt(s[0]); n Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 int  m =Integer.parseInt(s[1]); m Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 int  x =Integer.parseInt(s[2]); x Integer.parseInt(s[2]) Integer.parseInt Integer s[2] s 2 int arr[] = new int[m]; arr new int[m] m String s1[] = br.readLine().split(" "); s1 br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for (int i = 0; i < s1.length; i++) {
			arr[i]=Integer.parseInt(s1[i]);
		} int i = 0; int i = 0; i 0 i < s1.length i s1.length s1 s1.length i++ i++ i {
			arr[i]=Integer.parseInt(s1[i]);
		} {
			arr[i]=Integer.parseInt(s1[i]);
		} arr[i]=Integer.parseInt(s1[i]) arr[i] arr i Integer.parseInt(s1[i]) Integer.parseInt Integer s1[i] s1 i int res=0; res 0 for (int i = 0; i < arr.length; i++) {
			if(arr[i]<x) {
				res++;
			}
			else {
				break;
			}
		} int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i {
			if(arr[i]<x) {
				res++;
			}
			else {
				break;
			}
		} {
			if(arr[i]<x) {
				res++;
			}
			else {
				break;
			}
		} if(arr[i]<x) {
				res++;
			}
			else {
				break;
			} arr[i]<x arr[i] arr i x {
				res++;
			} res++ res {
				break;
			} break; System.out.println(Math.min(res, m-res)) System.out.println System.out System System.out Math.min(res, m-res) Math.min Math res m-res m res String[] args args


import java.io.*;
import java.util.*;
class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s[]=br.readLine().split(" ");
		int  n =Integer.parseInt(s[0]);
		int  m =Integer.parseInt(s[1]);
		int  x =Integer.parseInt(s[2]);
		int arr[] = new int[m];
		String s1[] = br.readLine().split(" ");
		for (int i = 0; i < s1.length; i++) {
			arr[i]=Integer.parseInt(s1[i]);
		}
		/*int res=0;
		int left = 0;
		int right = m-1;
		if(x > arr[m-1] || x< arr[0]) {
			System.out.println(0);
			
		}
		else {
		while(left<right) {
			int mid = (left+right)/2;
			//System.out.println("mid"+mid);
			if(arr[mid] < x) {
				res = mid;
				left = mid+1;
			}
			else {
				right = mid-1;
			}
		}
		if(arr[m-1] == n) {
			System.out.println(Math.min(res+1, m-res-2));
		}
		else
		System.out.println(Math.min(res+1, m-res-1));
		}*/
		int res=0;
		for (int i = 0; i < arr.length; i++) {
			if(arr[i]<x) {
				res++;
			}
			else {
				break;
			}
		}
		System.out.println(Math.min(res, m-res));
	}

}
