import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		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 < a.length; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		int cnt = 0;
		for (int i = 0; i < a.length; i++) {
			if (a[i] > x) {
				break;
			}
			cnt++;
		}
		System.out.println(Math.min(cnt, m - cnt));
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws Exception {
		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 < a.length; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		int cnt = 0;
		for (int i = 0; i < a.length; i++) {
			if (a[i] > x) {
				break;
			}
			cnt++;
		}
		System.out.println(Math.min(cnt, m - cnt));
	}
} Main public static void main(String[] args) throws Exception {
		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 < a.length; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		int cnt = 0;
		for (int i = 0; i < a.length; i++) {
			if (a[i] > x) {
				break;
			}
			cnt++;
		}
		System.out.println(Math.min(cnt, m - cnt));
	} 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 < a.length; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		int cnt = 0;
		for (int i = 0; i < a.length; i++) {
			if (a[i] > x) {
				break;
			}
			cnt++;
		}
		System.out.println(Math.min(cnt, m - cnt));
	} 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 < a.length; i++) {
			a[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
			a[i] = sc.nextInt();
		} {
			a[i] = sc.nextInt();
		} a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc sc.close() sc.close sc int cnt = 0; cnt 0 for (int i = 0; i < a.length; i++) {
			if (a[i] > x) {
				break;
			}
			cnt++;
		} int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
			if (a[i] > x) {
				break;
			}
			cnt++;
		} {
			if (a[i] > x) {
				break;
			}
			cnt++;
		} if (a[i] > x) {
				break;
			} a[i] > x a[i] a i x {
				break;
			} break; cnt++ cnt System.out.println(Math.min(cnt, m - cnt)) System.out.println System.out System System.out Math.min(cnt, m - cnt) Math.min Math cnt m - cnt m cnt String[] args args public class Main {
	public static void main(String[] args) throws Exception {
		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 < a.length; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		int cnt = 0;
		for (int i = 0; i < a.length; i++) {
			if (a[i] > x) {
				break;
			}
			cnt++;
		}
		System.out.println(Math.min(cnt, m - cnt));
	}
} public class Main {
	public static void main(String[] args) throws Exception {
		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 < a.length; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		int cnt = 0;
		for (int i = 0; i < a.length; i++) {
			if (a[i] > x) {
				break;
			}
			cnt++;
		}
		System.out.println(Math.min(cnt, m - cnt));
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		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 < a.length; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		int cnt = 0;
		for (int i = 0; i < a.length; i++) {
			if (a[i] > x) {
				break;
			}
			cnt++;
		}
		System.out.println(Math.min(cnt, m - cnt));
	}
}
