import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N,M,X,cost_r=0,cost_l=0;
        N=sc.nextInt();
        M=sc.nextInt();
        X=sc.nextInt();
        ArrayList<Integer> list = new ArrayList<Integer>();
        int [] cost = new int[N];
        for(int a=0;a<N;a++){
            cost[a]=0;
        }
        for(int a=0;a<M;a++){
            int num=sc.nextInt();
            cost[num] =1;
        }
        for(int a=1;a<N-1;a++){
            if(X-a>=0){
                cost_l += cost[X-a];
            }
            if(X+a<=N-1){
                cost_r+=cost[X+a];
            }
        }
        if(cost_r>=cost_l) System.out.println(cost_l);
        else System.out.println(cost_r);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N,M,X,cost_r=0,cost_l=0;
        N=sc.nextInt();
        M=sc.nextInt();
        X=sc.nextInt();
        ArrayList<Integer> list = new ArrayList<Integer>();
        int [] cost = new int[N];
        for(int a=0;a<N;a++){
            cost[a]=0;
        }
        for(int a=0;a<M;a++){
            int num=sc.nextInt();
            cost[num] =1;
        }
        for(int a=1;a<N-1;a++){
            if(X-a>=0){
                cost_l += cost[X-a];
            }
            if(X+a<=N-1){
                cost_r+=cost[X+a];
            }
        }
        if(cost_r>=cost_l) System.out.println(cost_l);
        else System.out.println(cost_r);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N,M,X,cost_r=0,cost_l=0;
        N=sc.nextInt();
        M=sc.nextInt();
        X=sc.nextInt();
        ArrayList<Integer> list = new ArrayList<Integer>();
        int [] cost = new int[N];
        for(int a=0;a<N;a++){
            cost[a]=0;
        }
        for(int a=0;a<M;a++){
            int num=sc.nextInt();
            cost[num] =1;
        }
        for(int a=1;a<N-1;a++){
            if(X-a>=0){
                cost_l += cost[X-a];
            }
            if(X+a<=N-1){
                cost_r+=cost[X+a];
            }
        }
        if(cost_r>=cost_l) System.out.println(cost_l);
        else System.out.println(cost_r);
    } main {
        Scanner sc = new Scanner(System.in);
        int N,M,X,cost_r=0,cost_l=0;
        N=sc.nextInt();
        M=sc.nextInt();
        X=sc.nextInt();
        ArrayList<Integer> list = new ArrayList<Integer>();
        int [] cost = new int[N];
        for(int a=0;a<N;a++){
            cost[a]=0;
        }
        for(int a=0;a<M;a++){
            int num=sc.nextInt();
            cost[num] =1;
        }
        for(int a=1;a<N-1;a++){
            if(X-a>=0){
                cost_l += cost[X-a];
            }
            if(X+a<=N-1){
                cost_r+=cost[X+a];
            }
        }
        if(cost_r>=cost_l) System.out.println(cost_l);
        else System.out.println(cost_r);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N N M M X X cost_r=0 cost_r 0 cost_l=0; cost_l 0 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 ArrayList<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() int [] cost = new int[N]; cost new int[N] N for(int a=0;a<N;a++){
            cost[a]=0;
        } int a=0; int a=0; a 0 a<N a N a++ a++ a {
            cost[a]=0;
        } {
            cost[a]=0;
        } cost[a]=0 cost[a] cost a 0 for(int a=0;a<M;a++){
            int num=sc.nextInt();
            cost[num] =1;
        } int a=0; int a=0; a 0 a<M a M a++ a++ a {
            int num=sc.nextInt();
            cost[num] =1;
        } {
            int num=sc.nextInt();
            cost[num] =1;
        } int num=sc.nextInt(); num sc.nextInt() sc.nextInt sc cost[num] =1 cost[num] cost num 1 for(int a=1;a<N-1;a++){
            if(X-a>=0){
                cost_l += cost[X-a];
            }
            if(X+a<=N-1){
                cost_r+=cost[X+a];
            }
        } int a=1; int a=1; a 1 a<N-1 a N-1 N 1 a++ a++ a {
            if(X-a>=0){
                cost_l += cost[X-a];
            }
            if(X+a<=N-1){
                cost_r+=cost[X+a];
            }
        } {
            if(X-a>=0){
                cost_l += cost[X-a];
            }
            if(X+a<=N-1){
                cost_r+=cost[X+a];
            }
        } if(X-a>=0){
                cost_l += cost[X-a];
            } X-a>=0 X-a X a 0 {
                cost_l += cost[X-a];
            } cost_l += cost[X-a] cost_l cost[X-a] cost X-a X a if(X+a<=N-1){
                cost_r+=cost[X+a];
            } X+a<=N-1 X+a X a N-1 N 1 {
                cost_r+=cost[X+a];
            } cost_r+=cost[X+a] cost_r cost[X+a] cost X+a X a if(cost_r>=cost_l) System.out.println(cost_l);
        else System.out.println(cost_r); cost_r>=cost_l cost_r cost_l System.out.println(cost_l) System.out.println System.out System System.out cost_l System.out.println(cost_r) System.out.println System.out System System.out cost_r String[] args args public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N,M,X,cost_r=0,cost_l=0;
        N=sc.nextInt();
        M=sc.nextInt();
        X=sc.nextInt();
        ArrayList<Integer> list = new ArrayList<Integer>();
        int [] cost = new int[N];
        for(int a=0;a<N;a++){
            cost[a]=0;
        }
        for(int a=0;a<M;a++){
            int num=sc.nextInt();
            cost[num] =1;
        }
        for(int a=1;a<N-1;a++){
            if(X-a>=0){
                cost_l += cost[X-a];
            }
            if(X+a<=N-1){
                cost_r+=cost[X+a];
            }
        }
        if(cost_r>=cost_l) System.out.println(cost_l);
        else System.out.println(cost_r);
    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N,M,X,cost_r=0,cost_l=0;
        N=sc.nextInt();
        M=sc.nextInt();
        X=sc.nextInt();
        ArrayList<Integer> list = new ArrayList<Integer>();
        int [] cost = new int[N];
        for(int a=0;a<N;a++){
            cost[a]=0;
        }
        for(int a=0;a<M;a++){
            int num=sc.nextInt();
            cost[num] =1;
        }
        for(int a=1;a<N-1;a++){
            if(X-a>=0){
                cost_l += cost[X-a];
            }
            if(X+a<=N-1){
                cost_r+=cost[X+a];
            }
        }
        if(cost_r>=cost_l) System.out.println(cost_l);
        else System.out.println(cost_r);
    }
} Main
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N,M,X,cost_r=0,cost_l=0;
        N=sc.nextInt();
        M=sc.nextInt();
        X=sc.nextInt();
        ArrayList<Integer> list = new ArrayList<Integer>();
        int [] cost = new int[N];
        for(int a=0;a<N;a++){
            cost[a]=0;
        }
        for(int a=0;a<M;a++){
            int num=sc.nextInt();
            cost[num] =1;
        }
        for(int a=1;a<N-1;a++){
            if(X-a>=0){
                cost_l += cost[X-a];
            }
            if(X+a<=N-1){
                cost_r+=cost[X+a];
            }
        }
        if(cost_r>=cost_l) System.out.println(cost_l);
        else System.out.println(cost_r);
    }
}