import java.util.Scanner;

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 f=-1;
long a[]=new long[m+1];
a[0]=-3;
for(int i=1;i<=m;i++){
	a[i]=sc.nextLong();
if(a[i-1]<x&&a[i]>x){
	f=i;
}
}

System.out.println(Math.min(f-1, m-f+1));

	}} import java.util.Scanner; Scanner 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 f=-1;
long a[]=new long[m+1];
a[0]=-3;
for(int i=1;i<=m;i++){
	a[i]=sc.nextLong();
if(a[i-1]<x&&a[i]>x){
	f=i;
}
}

System.out.println(Math.min(f-1, m-f+1));

	}} 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 f=-1;
long a[]=new long[m+1];
a[0]=-3;
for(int i=1;i<=m;i++){
	a[i]=sc.nextLong();
if(a[i-1]<x&&a[i]>x){
	f=i;
}
}

System.out.println(Math.min(f-1, m-f+1));

	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
int f=-1;
long a[]=new long[m+1];
a[0]=-3;
for(int i=1;i<=m;i++){
	a[i]=sc.nextLong();
if(a[i-1]<x&&a[i]>x){
	f=i;
}
}

System.out.println(Math.min(f-1, m-f+1));

	} 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 f=-1; f -1 1 long a[]=new long[m+1]; a new long[m+1] m+1 m 1 a[0]=-3 a[0] a 0 -3 3 for(int i=1;i<=m;i++){
	a[i]=sc.nextLong();
if(a[i-1]<x&&a[i]>x){
	f=i;
}
} int i=1; int i=1; i 1 i<=m i m i++ i++ i {
	a[i]=sc.nextLong();
if(a[i-1]<x&&a[i]>x){
	f=i;
}
} {
	a[i]=sc.nextLong();
if(a[i-1]<x&&a[i]>x){
	f=i;
}
} a[i]=sc.nextLong() a[i] a i sc.nextLong() sc.nextLong sc if(a[i-1]<x&&a[i]>x){
	f=i;
} a[i-1]<x&&a[i]>x a[i-1]<x a[i-1] a i-1 i 1 x a[i]>x a[i] a i x {
	f=i;
} f=i f i System.out.println(Math.min(f-1, m-f+1)) System.out.println System.out System System.out Math.min(f-1, m-f+1) Math.min Math f-1 f 1 m-f+1 m-f m f 1 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 f=-1;
long a[]=new long[m+1];
a[0]=-3;
for(int i=1;i<=m;i++){
	a[i]=sc.nextLong();
if(a[i-1]<x&&a[i]>x){
	f=i;
}
}

System.out.println(Math.min(f-1, m-f+1));

	}} 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 f=-1;
long a[]=new long[m+1];
a[0]=-3;
for(int i=1;i<=m;i++){
	a[i]=sc.nextLong();
if(a[i-1]<x&&a[i]>x){
	f=i;
}
}

System.out.println(Math.min(f-1, m-f+1));

	}} Main
import java.util.Scanner;

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 f=-1;
long a[]=new long[m+1];
a[0]=-3;
for(int i=1;i<=m;i++){
	a[i]=sc.nextLong();
if(a[i-1]<x&&a[i]>x){
	f=i;
}
}

System.out.println(Math.min(f-1, m-f+1));

	}}