import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);

		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		int x = Integer.parseInt(sc.next());

		int cost_0 = 0;
		for(int i = 0; i < m; i--) {
			if(Integer.parseInt(sc.next()) < x) {
				cost_0++;
			}else {
				break;
			}
		}
		
		int cost_x = m - cost_0;
		if(cost_0 <= cost_x) {
			System.out.println(cost_0);
		}else {
			System.out.println(cost_x);
		}

	}

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

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);

		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		int x = Integer.parseInt(sc.next());

		int cost_0 = 0;
		for(int i = 0; i < m; i--) {
			if(Integer.parseInt(sc.next()) < x) {
				cost_0++;
			}else {
				break;
			}
		}
		
		int cost_x = m - cost_0;
		if(cost_0 <= cost_x) {
			System.out.println(cost_0);
		}else {
			System.out.println(cost_x);
		}

	}

} Main public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);

		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		int x = Integer.parseInt(sc.next());

		int cost_0 = 0;
		for(int i = 0; i < m; i--) {
			if(Integer.parseInt(sc.next()) < x) {
				cost_0++;
			}else {
				break;
			}
		}
		
		int cost_x = m - cost_0;
		if(cost_0 <= cost_x) {
			System.out.println(cost_0);
		}else {
			System.out.println(cost_x);
		}

	} main {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);

		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		int x = Integer.parseInt(sc.next());

		int cost_0 = 0;
		for(int i = 0; i < m; i--) {
			if(Integer.parseInt(sc.next()) < x) {
				cost_0++;
			}else {
				break;
			}
		}
		
		int cost_x = m - cost_0;
		if(cost_0 <= cost_x) {
			System.out.println(cost_0);
		}else {
			System.out.println(cost_x);
		}

	} @SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int m = Integer.parseInt(sc.next()); m Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int x = Integer.parseInt(sc.next()); x Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int cost_0 = 0; cost_0 0 for(int i = 0; i < m; i--) {
			if(Integer.parseInt(sc.next()) < x) {
				cost_0++;
			}else {
				break;
			}
		} int i = 0; int i = 0; i 0 i < m i m i-- i-- i {
			if(Integer.parseInt(sc.next()) < x) {
				cost_0++;
			}else {
				break;
			}
		} {
			if(Integer.parseInt(sc.next()) < x) {
				cost_0++;
			}else {
				break;
			}
		} if(Integer.parseInt(sc.next()) < x) {
				cost_0++;
			}else {
				break;
			} Integer.parseInt(sc.next()) < x Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc x {
				cost_0++;
			} cost_0++ cost_0 {
				break;
			} break; int cost_x = m - cost_0; cost_x m - cost_0 m cost_0 if(cost_0 <= cost_x) {
			System.out.println(cost_0);
		}else {
			System.out.println(cost_x);
		} cost_0 <= cost_x cost_0 cost_x {
			System.out.println(cost_0);
		} System.out.println(cost_0) System.out.println System.out System System.out cost_0 {
			System.out.println(cost_x);
		} System.out.println(cost_x) System.out.println System.out System System.out cost_x String[] args args public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);

		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		int x = Integer.parseInt(sc.next());

		int cost_0 = 0;
		for(int i = 0; i < m; i--) {
			if(Integer.parseInt(sc.next()) < x) {
				cost_0++;
			}else {
				break;
			}
		}
		
		int cost_x = m - cost_0;
		if(cost_0 <= cost_x) {
			System.out.println(cost_0);
		}else {
			System.out.println(cost_x);
		}

	}

} public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);

		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		int x = Integer.parseInt(sc.next());

		int cost_0 = 0;
		for(int i = 0; i < m; i--) {
			if(Integer.parseInt(sc.next()) < x) {
				cost_0++;
			}else {
				break;
			}
		}
		
		int cost_x = m - cost_0;
		if(cost_0 <= cost_x) {
			System.out.println(cost_0);
		}else {
			System.out.println(cost_x);
		}

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);

		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		int x = Integer.parseInt(sc.next());

		int cost_0 = 0;
		for(int i = 0; i < m; i--) {
			if(Integer.parseInt(sc.next()) < x) {
				cost_0++;
			}else {
				break;
			}
		}
		
		int cost_x = m - cost_0;
		if(cost_0 <= cost_x) {
			System.out.println(cost_0);
		}else {
			System.out.println(cost_x);
		}

	}

}
