import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int x = scanner.nextInt();
		int[] a = new int[m];
		int count = 0;
		
		for(int b = 0; b < m; b++) {
			a[b] = scanner.nextInt(); 
		}
		for(int r = 0; r < m; r++) {
			if(a[r] < x) {
				count++;
			}else {
				break;
			}
		}
		int ans = a[0] > x ? 0 : Math.min(a.length - count , count);
		System.out.println(ans);
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int x = scanner.nextInt();
		int[] a = new int[m];
		int count = 0;
		
		for(int b = 0; b < m; b++) {
			a[b] = scanner.nextInt(); 
		}
		for(int r = 0; r < m; r++) {
			if(a[r] < x) {
				count++;
			}else {
				break;
			}
		}
		int ans = a[0] > x ? 0 : Math.min(a.length - count , count);
		System.out.println(ans);
	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int x = scanner.nextInt();
		int[] a = new int[m];
		int count = 0;
		
		for(int b = 0; b < m; b++) {
			a[b] = scanner.nextInt(); 
		}
		for(int r = 0; r < m; r++) {
			if(a[r] < x) {
				count++;
			}else {
				break;
			}
		}
		int ans = a[0] > x ? 0 : Math.min(a.length - count , count);
		System.out.println(ans);
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int x = scanner.nextInt();
		int[] a = new int[m];
		int count = 0;
		
		for(int b = 0; b < m; b++) {
			a[b] = scanner.nextInt(); 
		}
		for(int r = 0; r < m; r++) {
			if(a[r] < x) {
				count++;
			}else {
				break;
			}
		}
		int ans = a[0] > x ? 0 : Math.min(a.length - count , count);
		System.out.println(ans);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int m = scanner.nextInt(); m scanner.nextInt() scanner.nextInt scanner int x = scanner.nextInt(); x scanner.nextInt() scanner.nextInt scanner int[] a = new int[m]; a new int[m] m int count = 0; count 0 for(int b = 0; b < m; b++) {
			a[b] = scanner.nextInt(); 
		} int b = 0; int b = 0; b 0 b < m b m b++ b++ b {
			a[b] = scanner.nextInt(); 
		} {
			a[b] = scanner.nextInt(); 
		} a[b] = scanner.nextInt() a[b] a b scanner.nextInt() scanner.nextInt scanner for(int r = 0; r < m; r++) {
			if(a[r] < x) {
				count++;
			}else {
				break;
			}
		} int r = 0; int r = 0; r 0 r < m r m r++ r++ r {
			if(a[r] < x) {
				count++;
			}else {
				break;
			}
		} {
			if(a[r] < x) {
				count++;
			}else {
				break;
			}
		} if(a[r] < x) {
				count++;
			}else {
				break;
			} a[r] < x a[r] a r x {
				count++;
			} count++ count {
				break;
			} break; int ans = a[0] > x ? 0 : Math.min(a.length - count , count); ans a[0] > x ? 0 : Math.min(a.length - count , count) a[0] > x a[0] a 0 x 0 Math.min(a.length - count , count) Math.min Math a.length - count a.length a a.length count count System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int x = scanner.nextInt();
		int[] a = new int[m];
		int count = 0;
		
		for(int b = 0; b < m; b++) {
			a[b] = scanner.nextInt(); 
		}
		for(int r = 0; r < m; r++) {
			if(a[r] < x) {
				count++;
			}else {
				break;
			}
		}
		int ans = a[0] > x ? 0 : Math.min(a.length - count , count);
		System.out.println(ans);
	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int x = scanner.nextInt();
		int[] a = new int[m];
		int count = 0;
		
		for(int b = 0; b < m; b++) {
			a[b] = scanner.nextInt(); 
		}
		for(int r = 0; r < m; r++) {
			if(a[r] < x) {
				count++;
			}else {
				break;
			}
		}
		int ans = a[0] > x ? 0 : Math.min(a.length - count , count);
		System.out.println(ans);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int x = scanner.nextInt();
		int[] a = new int[m];
		int count = 0;
		
		for(int b = 0; b < m; b++) {
			a[b] = scanner.nextInt(); 
		}
		for(int r = 0; r < m; r++) {
			if(a[r] < x) {
				count++;
			}else {
				break;
			}
		}
		int ans = a[0] > x ? 0 : Math.min(a.length - count , count);
		System.out.println(ans);
	}

}