import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Iterator;
import java.util.Collections;
import java.util.Comparator;

class Route{

        private int N ;
        private int M ;
        private int X ;
        ArrayList<Integer> center = new ArrayList<Integer>();
        ArrayList<Integer> chip = new ArrayList<Integer>();


        Route(int n,int m,int x){
                this.N = n;
                this.M = m;
                this.X = x;
        }

        public void addCenter(int a){
                this.center.add(a);
        }
        public void setChip(){
                for(int i=0;i<=this.N;i++){
                        if(this.center.indexOf(i) >= 0){
                                this.chip.add(1);
                        }else if(this.center.indexOf(i) == -1){
                                this.chip.add(0);
                        }
                }
        }

        public int x2zero(){
                int cost = 0;
                for(int i=this.X; i>=0; i--){
                        cost += this.chip.get(i);
                }
                return cost;
        }
        public int x2N(){
                int cost = 0;
                for(int i=this.X; i<=N; i++){
                        cost += this.chip.get(i);
                }
                return cost;
        }

        public int getN(){return this.N;}
        public int getM(){return this.M;}
        public int getX(){return this.X;}


}

class Main{
        public static void main(String args[]){
                Scanner scan = new Scanner(System.in);
                Route route = new Route(scan.nextInt(),scan.nextInt(),scan.nextInt());
                for(int i=0;i<route.getM();i++) route.addCenter(scan.nextInt());
                route.setChip();
                int toZero = route.x2zero();
                int toN = route.x2N();

                System.out.println(Math.min(toZero,toN));

        }
} import java.util.Scanner; Scanner java.util import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.List; List java.util import java.util.Iterator; Iterator java.util import java.util.Collections; Collections java.util import java.util.Comparator; Comparator java.util class Route{

        private int N ;
        private int M ;
        private int X ;
        ArrayList<Integer> center = new ArrayList<Integer>();
        ArrayList<Integer> chip = new ArrayList<Integer>();


        Route(int n,int m,int x){
                this.N = n;
                this.M = m;
                this.X = x;
        }

        public void addCenter(int a){
                this.center.add(a);
        }
        public void setChip(){
                for(int i=0;i<=this.N;i++){
                        if(this.center.indexOf(i) >= 0){
                                this.chip.add(1);
                        }else if(this.center.indexOf(i) == -1){
                                this.chip.add(0);
                        }
                }
        }

        public int x2zero(){
                int cost = 0;
                for(int i=this.X; i>=0; i--){
                        cost += this.chip.get(i);
                }
                return cost;
        }
        public int x2N(){
                int cost = 0;
                for(int i=this.X; i<=N; i++){
                        cost += this.chip.get(i);
                }
                return cost;
        }

        public int getN(){return this.N;}
        public int getM(){return this.M;}
        public int getX(){return this.X;}


} Route private int N ; N private int M ; M private int X ; X ArrayList<Integer> center = new ArrayList<Integer>(); center new ArrayList<Integer>() ArrayList<Integer> chip = new ArrayList<Integer>(); chip new ArrayList<Integer>() Route(int n,int m,int x){
                this.N = n;
                this.M = m;
                this.X = x;
        } Route {
                this.N = n;
                this.M = m;
                this.X = x;
        } this.N = n this.N this this.N n this.M = m this.M this this.M m this.X = x this.X this this.X x int n n int m m int x x public void addCenter(int a){
                this.center.add(a);
        } addCenter {
                this.center.add(a);
        } this.center.add(a) this.center.add this.center this this.center a int a a public void setChip(){
                for(int i=0;i<=this.N;i++){
                        if(this.center.indexOf(i) >= 0){
                                this.chip.add(1);
                        }else if(this.center.indexOf(i) == -1){
                                this.chip.add(0);
                        }
                }
        } setChip {
                for(int i=0;i<=this.N;i++){
                        if(this.center.indexOf(i) >= 0){
                                this.chip.add(1);
                        }else if(this.center.indexOf(i) == -1){
                                this.chip.add(0);
                        }
                }
        } for(int i=0;i<=this.N;i++){
                        if(this.center.indexOf(i) >= 0){
                                this.chip.add(1);
                        }else if(this.center.indexOf(i) == -1){
                                this.chip.add(0);
                        }
                } int i=0; int i=0; i 0 i<=this.N i this.N this this.N i++ i++ i {
                        if(this.center.indexOf(i) >= 0){
                                this.chip.add(1);
                        }else if(this.center.indexOf(i) == -1){
                                this.chip.add(0);
                        }
                } {
                        if(this.center.indexOf(i) >= 0){
                                this.chip.add(1);
                        }else if(this.center.indexOf(i) == -1){
                                this.chip.add(0);
                        }
                } if(this.center.indexOf(i) >= 0){
                                this.chip.add(1);
                        }else if(this.center.indexOf(i) == -1){
                                this.chip.add(0);
                        } this.center.indexOf(i) >= 0 this.center.indexOf(i) this.center.indexOf this.center this this.center i 0 {
                                this.chip.add(1);
                        } this.chip.add(1) this.chip.add this.chip this this.chip 1 if(this.center.indexOf(i) == -1){
                                this.chip.add(0);
                        } this.center.indexOf(i) == -1 this.center.indexOf(i) this.center.indexOf this.center this this.center i -1 1 {
                                this.chip.add(0);
                        } this.chip.add(0) this.chip.add this.chip this this.chip 0 public int x2zero(){
                int cost = 0;
                for(int i=this.X; i>=0; i--){
                        cost += this.chip.get(i);
                }
                return cost;
        } x2zero {
                int cost = 0;
                for(int i=this.X; i>=0; i--){
                        cost += this.chip.get(i);
                }
                return cost;
        } int cost = 0; cost 0 for(int i=this.X; i>=0; i--){
                        cost += this.chip.get(i);
                } int i=this.X; int i=this.X; i this.X this this.X i>=0 i 0 i-- i-- i {
                        cost += this.chip.get(i);
                } {
                        cost += this.chip.get(i);
                } cost += this.chip.get(i) cost this.chip.get(i) this.chip.get this.chip this this.chip i return cost; cost public int x2N(){
                int cost = 0;
                for(int i=this.X; i<=N; i++){
                        cost += this.chip.get(i);
                }
                return cost;
        } x2N {
                int cost = 0;
                for(int i=this.X; i<=N; i++){
                        cost += this.chip.get(i);
                }
                return cost;
        } int cost = 0; cost 0 for(int i=this.X; i<=N; i++){
                        cost += this.chip.get(i);
                } int i=this.X; int i=this.X; i this.X this this.X i<=N i N i++ i++ i {
                        cost += this.chip.get(i);
                } {
                        cost += this.chip.get(i);
                } cost += this.chip.get(i) cost this.chip.get(i) this.chip.get this.chip this this.chip i return cost; cost public int getN(){return this.N;} getN {return this.N;} return this.N; this.N this this.N public int getM(){return this.M;} getM {return this.M;} return this.M; this.M this this.M public int getX(){return this.X;} getX {return this.X;} return this.X; this.X this this.X class Main{
        public static void main(String args[]){
                Scanner scan = new Scanner(System.in);
                Route route = new Route(scan.nextInt(),scan.nextInt(),scan.nextInt());
                for(int i=0;i<route.getM();i++) route.addCenter(scan.nextInt());
                route.setChip();
                int toZero = route.x2zero();
                int toN = route.x2N();

                System.out.println(Math.min(toZero,toN));

        }
} Main public static void main(String args[]){
                Scanner scan = new Scanner(System.in);
                Route route = new Route(scan.nextInt(),scan.nextInt(),scan.nextInt());
                for(int i=0;i<route.getM();i++) route.addCenter(scan.nextInt());
                route.setChip();
                int toZero = route.x2zero();
                int toN = route.x2N();

                System.out.println(Math.min(toZero,toN));

        } main {
                Scanner scan = new Scanner(System.in);
                Route route = new Route(scan.nextInt(),scan.nextInt(),scan.nextInt());
                for(int i=0;i<route.getM();i++) route.addCenter(scan.nextInt());
                route.setChip();
                int toZero = route.x2zero();
                int toN = route.x2N();

                System.out.println(Math.min(toZero,toN));

        } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) Route route = new Route(scan.nextInt(),scan.nextInt(),scan.nextInt()); route new Route(scan.nextInt(),scan.nextInt(),scan.nextInt()) for(int i=0;i<route.getM();i++) route.addCenter(scan.nextInt()); int i=0; int i=0; i 0 i<route.getM() i route.getM() route.getM route i++ i++ i route.addCenter(scan.nextInt()); route.addCenter(scan.nextInt()) route.addCenter route scan.nextInt() scan.nextInt scan route.setChip() route.setChip route int toZero = route.x2zero(); toZero route.x2zero() route.x2zero route int toN = route.x2N(); toN route.x2N() route.x2N route System.out.println(Math.min(toZero,toN)) System.out.println System.out System System.out Math.min(toZero,toN) Math.min Math toZero toN String args[] args
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Iterator;
import java.util.Collections;
import java.util.Comparator;

class Route{

        private int N ;
        private int M ;
        private int X ;
        ArrayList<Integer> center = new ArrayList<Integer>();
        ArrayList<Integer> chip = new ArrayList<Integer>();


        Route(int n,int m,int x){
                this.N = n;
                this.M = m;
                this.X = x;
        }

        public void addCenter(int a){
                this.center.add(a);
        }
        public void setChip(){
                for(int i=0;i<=this.N;i++){
                        if(this.center.indexOf(i) >= 0){
                                this.chip.add(1);
                        }else if(this.center.indexOf(i) == -1){
                                this.chip.add(0);
                        }
                }
        }

        public int x2zero(){
                int cost = 0;
                for(int i=this.X; i>=0; i--){
                        cost += this.chip.get(i);
                }
                return cost;
        }
        public int x2N(){
                int cost = 0;
                for(int i=this.X; i<=N; i++){
                        cost += this.chip.get(i);
                }
                return cost;
        }

        public int getN(){return this.N;}
        public int getM(){return this.M;}
        public int getX(){return this.X;}


}

class Main{
        public static void main(String args[]){
                Scanner scan = new Scanner(System.in);
                Route route = new Route(scan.nextInt(),scan.nextInt(),scan.nextInt());
                for(int i=0;i<route.getM();i++) route.addCenter(scan.nextInt());
                route.setChip();
                int toZero = route.x2zero();
                int toN = route.x2N();

                System.out.println(Math.min(toZero,toN));

        }
}
