import java.math.BigInteger;
import java.util.*;
import java.lang.*;

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

} import java.math.BigInteger; BigInteger java.math import java.util.*; util.* java import java.lang.*; lang.* java 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 a[] = new int[m];
        for (int i = 0; i < m; i++) {
            a[i] = sc.nextInt();
        }
        int max = -1;
        for (int i = 0; i < m; i++) {
            if (a[i] < x) {
                max = i;
            } else {
                break;
            }
        }
        System.out.println(Math.min(max + 1, m - (max + 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 a[] = new int[m];
        for (int i = 0; i < m; i++) {
            a[i] = sc.nextInt();
        }
        int max = -1;
        for (int i = 0; i < m; i++) {
            if (a[i] < x) {
                max = i;
            } else {
                break;
            }
        }
        System.out.println(Math.min(max + 1, m - (max + 1)));
    } 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 < m; i++) {
            a[i] = sc.nextInt();
        }
        int max = -1;
        for (int i = 0; i < m; i++) {
            if (a[i] < x) {
                max = i;
            } else {
                break;
            }
        }
        System.out.println(Math.min(max + 1, m - (max + 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 a[] = new int[m]; a new int[m] m for (int i = 0; i < m; i++) {
            a[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
            a[i] = sc.nextInt();
        } {
            a[i] = sc.nextInt();
        } a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc int max = -1; max -1 1 for (int i = 0; i < m; i++) {
            if (a[i] < x) {
                max = i;
            } else {
                break;
            }
        } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
            if (a[i] < x) {
                max = i;
            } else {
                break;
            }
        } {
            if (a[i] < x) {
                max = i;
            } else {
                break;
            }
        } if (a[i] < x) {
                max = i;
            } else {
                break;
            } a[i] < x a[i] a i x {
                max = i;
            } max = i max i {
                break;
            } break; System.out.println(Math.min(max + 1, m - (max + 1))) System.out.println System.out System System.out Math.min(max + 1, m - (max + 1)) Math.min Math max + 1 max 1 m - (max + 1) m (max + 1) max 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 a[] = new int[m];
        for (int i = 0; i < m; i++) {
            a[i] = sc.nextInt();
        }
        int max = -1;
        for (int i = 0; i < m; i++) {
            if (a[i] < x) {
                max = i;
            } else {
                break;
            }
        }
        System.out.println(Math.min(max + 1, m - (max + 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 a[] = new int[m];
        for (int i = 0; i < m; i++) {
            a[i] = sc.nextInt();
        }
        int max = -1;
        for (int i = 0; i < m; i++) {
            if (a[i] < x) {
                max = i;
            } else {
                break;
            }
        }
        System.out.println(Math.min(max + 1, m - (max + 1)));
    }

} Main
import java.math.BigInteger;
import java.util.*;
import java.lang.*;

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

}