import java.util.Scanner;
import java.util.Arrays;

public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N=sc.nextInt();
        boolean[] A=new boolean[N];
        Arrays.fill(A, false);
        int M=sc.nextInt();
        int X=sc.nextInt();
        X--;
        for(int i=0;i<M;i++){
            int a=sc.nextInt();
            a--;
            A[a]=true;
        }
        int ans=0;
        for(int i=X;i<N;i++){
            if(A[i]==true)ans++;
        }
        int answer=0;
        for(int i=X;i>=0;i--){
            if(A[i]==true)answer++;
        }
        System.out.println(Math.min(ans, answer));
    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N=sc.nextInt();
        boolean[] A=new boolean[N];
        Arrays.fill(A, false);
        int M=sc.nextInt();
        int X=sc.nextInt();
        X--;
        for(int i=0;i<M;i++){
            int a=sc.nextInt();
            a--;
            A[a]=true;
        }
        int ans=0;
        for(int i=X;i<N;i++){
            if(A[i]==true)ans++;
        }
        int answer=0;
        for(int i=X;i>=0;i--){
            if(A[i]==true)answer++;
        }
        System.out.println(Math.min(ans, answer));
    }
} Main public static void main(String[] args) {
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args void solve() {
        Scanner sc = new Scanner(System.in);
        int N=sc.nextInt();
        boolean[] A=new boolean[N];
        Arrays.fill(A, false);
        int M=sc.nextInt();
        int X=sc.nextInt();
        X--;
        for(int i=0;i<M;i++){
            int a=sc.nextInt();
            a--;
            A[a]=true;
        }
        int ans=0;
        for(int i=X;i<N;i++){
            if(A[i]==true)ans++;
        }
        int answer=0;
        for(int i=X;i>=0;i--){
            if(A[i]==true)answer++;
        }
        System.out.println(Math.min(ans, answer));
    } solve {
        Scanner sc = new Scanner(System.in);
        int N=sc.nextInt();
        boolean[] A=new boolean[N];
        Arrays.fill(A, false);
        int M=sc.nextInt();
        int X=sc.nextInt();
        X--;
        for(int i=0;i<M;i++){
            int a=sc.nextInt();
            a--;
            A[a]=true;
        }
        int ans=0;
        for(int i=X;i<N;i++){
            if(A[i]==true)ans++;
        }
        int answer=0;
        for(int i=X;i>=0;i--){
            if(A[i]==true)answer++;
        }
        System.out.println(Math.min(ans, answer));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N=sc.nextInt(); N sc.nextInt() sc.nextInt sc boolean[] A=new boolean[N]; A new boolean[N] N Arrays.fill(A, false) Arrays.fill Arrays A false int M=sc.nextInt(); M sc.nextInt() sc.nextInt sc int X=sc.nextInt(); X sc.nextInt() sc.nextInt sc X-- X for(int i=0;i<M;i++){
            int a=sc.nextInt();
            a--;
            A[a]=true;
        } int i=0; int i=0; i 0 i<M i M i++ i++ i {
            int a=sc.nextInt();
            a--;
            A[a]=true;
        } {
            int a=sc.nextInt();
            a--;
            A[a]=true;
        } int a=sc.nextInt(); a sc.nextInt() sc.nextInt sc a-- a A[a]=true A[a] A a true int ans=0; ans 0 for(int i=X;i<N;i++){
            if(A[i]==true)ans++;
        } int i=X; int i=X; i X i<N i N i++ i++ i {
            if(A[i]==true)ans++;
        } {
            if(A[i]==true)ans++;
        } if(A[i]==true)ans++; A[i]==true A[i] A i true ans++ ans int answer=0; answer 0 for(int i=X;i>=0;i--){
            if(A[i]==true)answer++;
        } int i=X; int i=X; i X i>=0 i 0 i-- i-- i {
            if(A[i]==true)answer++;
        } {
            if(A[i]==true)answer++;
        } if(A[i]==true)answer++; A[i]==true A[i] A i true answer++ answer System.out.println(Math.min(ans, answer)) System.out.println System.out System System.out Math.min(ans, answer) Math.min Math ans answer public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N=sc.nextInt();
        boolean[] A=new boolean[N];
        Arrays.fill(A, false);
        int M=sc.nextInt();
        int X=sc.nextInt();
        X--;
        for(int i=0;i<M;i++){
            int a=sc.nextInt();
            a--;
            A[a]=true;
        }
        int ans=0;
        for(int i=X;i<N;i++){
            if(A[i]==true)ans++;
        }
        int answer=0;
        for(int i=X;i>=0;i--){
            if(A[i]==true)answer++;
        }
        System.out.println(Math.min(ans, answer));
    }
} public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N=sc.nextInt();
        boolean[] A=new boolean[N];
        Arrays.fill(A, false);
        int M=sc.nextInt();
        int X=sc.nextInt();
        X--;
        for(int i=0;i<M;i++){
            int a=sc.nextInt();
            a--;
            A[a]=true;
        }
        int ans=0;
        for(int i=X;i<N;i++){
            if(A[i]==true)ans++;
        }
        int answer=0;
        for(int i=X;i>=0;i--){
            if(A[i]==true)answer++;
        }
        System.out.println(Math.min(ans, answer));
    }
} Main
import java.util.Scanner;
import java.util.Arrays;

public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N=sc.nextInt();
        boolean[] A=new boolean[N];
        Arrays.fill(A, false);
        int M=sc.nextInt();
        int X=sc.nextInt();
        X--;
        for(int i=0;i<M;i++){
            int a=sc.nextInt();
            a--;
            A[a]=true;
        }
        int ans=0;
        for(int i=X;i<N;i++){
            if(A[i]==true)ans++;
        }
        int answer=0;
        for(int i=X;i>=0;i--){
            if(A[i]==true)answer++;
        }
        System.out.println(Math.min(ans, answer));
    }
}