import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		
		int[] P = new int[N+1];
		for(int i=0;i<M;i++) {
			int j = sc.nextInt();
			P[j] = 1;
		}
		sc.close();
		
		//左
		int ansL = 0;
		for(int i=X;i>=0;i--) {
			ansL += P[i];
		}
		
		//右
		int ansR = 0;
		for(int i=X;i<N;i++) {
			ansR += P[i];
		}
		
		out.println(Math.min(ansL, ansR));

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
} import java.io.InputStream; InputStream java.io import java.io.PrintStream; PrintStream java.io import java.util.Scanner; Scanner java.util public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		
		int[] P = new int[N+1];
		for(int i=0;i<M;i++) {
			int j = sc.nextInt();
			P[j] = 1;
		}
		sc.close();
		
		//左
		int ansL = 0;
		for(int i=X;i>=0;i--) {
			ansL += P[i];
		}
		
		//右
		int ansR = 0;
		for(int i=X;i<N;i++) {
			ansR += P[i];
		}
		
		out.println(Math.min(ansL, ansR));

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
} Main InputStream in = System.in; in System.in System System.in PrintStream out = System.out; out System.out System System.out public void _main(String[] args) {
		Scanner sc = new Scanner(in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		
		int[] P = new int[N+1];
		for(int i=0;i<M;i++) {
			int j = sc.nextInt();
			P[j] = 1;
		}
		sc.close();
		
		//左
		int ansL = 0;
		for(int i=X;i>=0;i--) {
			ansL += P[i];
		}
		
		//右
		int ansR = 0;
		for(int i=X;i<N;i++) {
			ansR += P[i];
		}
		
		out.println(Math.min(ansL, ansR));

	} _main {
		Scanner sc = new Scanner(in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		
		int[] P = new int[N+1];
		for(int i=0;i<M;i++) {
			int j = sc.nextInt();
			P[j] = 1;
		}
		sc.close();
		
		//左
		int ansL = 0;
		for(int i=X;i>=0;i--) {
			ansL += P[i];
		}
		
		//右
		int ansR = 0;
		for(int i=X;i<N;i++) {
			ansR += P[i];
		}
		
		out.println(Math.min(ansL, ansR));

	} Scanner sc = new Scanner(in); sc new Scanner(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[] P = new int[N+1]; P new int[N+1] N+1 N 1 for(int i=0;i<M;i++) {
			int j = sc.nextInt();
			P[j] = 1;
		} int i=0; int i=0; i 0 i<M i M i++ i++ i {
			int j = sc.nextInt();
			P[j] = 1;
		} {
			int j = sc.nextInt();
			P[j] = 1;
		} int j = sc.nextInt(); j sc.nextInt() sc.nextInt sc P[j] = 1 P[j] P j 1 sc.close() sc.close sc int ansL = 0; ansL 0 for(int i=X;i>=0;i--) {
			ansL += P[i];
		} int i=X; int i=X; i X i>=0 i 0 i-- i-- i {
			ansL += P[i];
		} {
			ansL += P[i];
		} ansL += P[i] ansL P[i] P i int ansR = 0; ansR 0 for(int i=X;i<N;i++) {
			ansR += P[i];
		} int i=X; int i=X; i X i<N i N i++ i++ i {
			ansR += P[i];
		} {
			ansR += P[i];
		} ansR += P[i] ansR P[i] P i out.println(Math.min(ansL, ansR)) out.println out Math.min(ansL, ansR) Math.min Math ansL ansR String[] args args public static void main(String[] args) {
		new Main()._main(args);
	} main {
		new Main()._main(args);
	} new Main()._main(args) new Main()._main new Main() args String[] args args public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		
		int[] P = new int[N+1];
		for(int i=0;i<M;i++) {
			int j = sc.nextInt();
			P[j] = 1;
		}
		sc.close();
		
		//左
		int ansL = 0;
		for(int i=X;i>=0;i--) {
			ansL += P[i];
		}
		
		//右
		int ansR = 0;
		for(int i=X;i<N;i++) {
			ansR += P[i];
		}
		
		out.println(Math.min(ansL, ansR));

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
} public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		
		int[] P = new int[N+1];
		for(int i=0;i<M;i++) {
			int j = sc.nextInt();
			P[j] = 1;
		}
		sc.close();
		
		//左
		int ansL = 0;
		for(int i=X;i>=0;i--) {
			ansL += P[i];
		}
		
		//右
		int ansR = 0;
		for(int i=X;i<N;i++) {
			ansR += P[i];
		}
		
		out.println(Math.min(ansL, ansR));

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
} Main
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		
		int[] P = new int[N+1];
		for(int i=0;i<M;i++) {
			int j = sc.nextInt();
			P[j] = 1;
		}
		sc.close();
		
		//左
		int ansL = 0;
		for(int i=X;i>=0;i--) {
			ansL += P[i];
		}
		
		//右
		int ansR = 0;
		for(int i=X;i<N;i++) {
			ansR += P[i];
		}
		
		out.println(Math.min(ansL, ansR));

	}

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