import java.util.Scanner;

public class Main{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int N, M, X;
        N = sc.nextInt();
        M = sc.nextInt();
        X = sc.nextInt();

        int[] A = new int[M];
        for (int i = 0; i < M; ++i){
            A[i] = sc.nextInt();
        }

        int l = 0;
        int r = 0;
        for (int i = 0; i < M; ++i){
            if (A[i] < X){
                ++l;
            }else if (A[i] > X){
                ++r;
            }
        }
        System.out.println(Math.min(l, r));
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int N, M, X;
        N = sc.nextInt();
        M = sc.nextInt();
        X = sc.nextInt();

        int[] A = new int[M];
        for (int i = 0; i < M; ++i){
            A[i] = sc.nextInt();
        }

        int l = 0;
        int r = 0;
        for (int i = 0; i < M; ++i){
            if (A[i] < X){
                ++l;
            }else if (A[i] > X){
                ++r;
            }
        }
        System.out.println(Math.min(l, r));
    }
} Main public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int N, M, X;
        N = sc.nextInt();
        M = sc.nextInt();
        X = sc.nextInt();

        int[] A = new int[M];
        for (int i = 0; i < M; ++i){
            A[i] = sc.nextInt();
        }

        int l = 0;
        int r = 0;
        for (int i = 0; i < M; ++i){
            if (A[i] < X){
                ++l;
            }else if (A[i] > X){
                ++r;
            }
        }
        System.out.println(Math.min(l, r));
    } main {
        Scanner sc = new Scanner(System.in);
        int N, M, X;
        N = sc.nextInt();
        M = sc.nextInt();
        X = sc.nextInt();

        int[] A = new int[M];
        for (int i = 0; i < M; ++i){
            A[i] = sc.nextInt();
        }

        int l = 0;
        int r = 0;
        for (int i = 0; i < M; ++i){
            if (A[i] < X){
                ++l;
            }else if (A[i] > X){
                ++r;
            }
        }
        System.out.println(Math.min(l, r));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N N M M X; X N = sc.nextInt() N sc.nextInt() sc.nextInt sc M = sc.nextInt() M sc.nextInt() sc.nextInt sc 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 l = 0; l 0 int r = 0; r 0 for (int i = 0; i < M; ++i){
            if (A[i] < X){
                ++l;
            }else if (A[i] > X){
                ++r;
            }
        } int i = 0; int i = 0; i 0 i < M i M ++i ++i i {
            if (A[i] < X){
                ++l;
            }else if (A[i] > X){
                ++r;
            }
        } {
            if (A[i] < X){
                ++l;
            }else if (A[i] > X){
                ++r;
            }
        } if (A[i] < X){
                ++l;
            }else if (A[i] > X){
                ++r;
            } A[i] < X A[i] A i X {
                ++l;
            } ++l l if (A[i] > X){
                ++r;
            } A[i] > X A[i] A i X {
                ++r;
            } ++r r System.out.println(Math.min(l, r)) System.out.println System.out System System.out Math.min(l, r) Math.min Math l r String args[] args public class Main{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int N, M, X;
        N = sc.nextInt();
        M = sc.nextInt();
        X = sc.nextInt();

        int[] A = new int[M];
        for (int i = 0; i < M; ++i){
            A[i] = sc.nextInt();
        }

        int l = 0;
        int r = 0;
        for (int i = 0; i < M; ++i){
            if (A[i] < X){
                ++l;
            }else if (A[i] > X){
                ++r;
            }
        }
        System.out.println(Math.min(l, r));
    }
} public class Main{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int N, M, X;
        N = sc.nextInt();
        M = sc.nextInt();
        X = sc.nextInt();

        int[] A = new int[M];
        for (int i = 0; i < M; ++i){
            A[i] = sc.nextInt();
        }

        int l = 0;
        int r = 0;
        for (int i = 0; i < M; ++i){
            if (A[i] < X){
                ++l;
            }else if (A[i] > X){
                ++r;
            }
        }
        System.out.println(Math.min(l, r));
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int N, M, X;
        N = sc.nextInt();
        M = sc.nextInt();
        X = sc.nextInt();

        int[] A = new int[M];
        for (int i = 0; i < M; ++i){
            A[i] = sc.nextInt();
        }

        int l = 0;
        int r = 0;
        for (int i = 0; i < M; ++i){
            if (A[i] < X){
                ++l;
            }else if (A[i] > X){
                ++r;
            }
        }
        System.out.println(Math.min(l, r));
    }
}