import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tmp = br.readLine().split(" ");
		int N = Integer.parseInt(tmp[0]);
		int M = Integer.parseInt(tmp[1]);
		int X = Integer.parseInt(tmp[2]);
		List<Integer> A = new ArrayList<Integer>();
		tmp = br.readLine().split(" ");
		for(int i = 0;i<M;i++){
			A.add(Integer.parseInt(tmp[i]));
		}
		int countL = 0;
		int countR = 0;
		//左へ行く場合
		for(int l = X;l>0;l--){
			if(A.contains(l))countL++;
		}
		//右へいく場合
		for(int r = X;r<=N;r++){
			if(A.contains(r))countR++;
		}

		System.out.println(Math.min(countL,countR));
	}


} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tmp = br.readLine().split(" ");
		int N = Integer.parseInt(tmp[0]);
		int M = Integer.parseInt(tmp[1]);
		int X = Integer.parseInt(tmp[2]);
		List<Integer> A = new ArrayList<Integer>();
		tmp = br.readLine().split(" ");
		for(int i = 0;i<M;i++){
			A.add(Integer.parseInt(tmp[i]));
		}
		int countL = 0;
		int countR = 0;
		//左へ行く場合
		for(int l = X;l>0;l--){
			if(A.contains(l))countL++;
		}
		//右へいく場合
		for(int r = X;r<=N;r++){
			if(A.contains(r))countR++;
		}

		System.out.println(Math.min(countL,countR));
	}


} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tmp = br.readLine().split(" ");
		int N = Integer.parseInt(tmp[0]);
		int M = Integer.parseInt(tmp[1]);
		int X = Integer.parseInt(tmp[2]);
		List<Integer> A = new ArrayList<Integer>();
		tmp = br.readLine().split(" ");
		for(int i = 0;i<M;i++){
			A.add(Integer.parseInt(tmp[i]));
		}
		int countL = 0;
		int countR = 0;
		//左へ行く場合
		for(int l = X;l>0;l--){
			if(A.contains(l))countL++;
		}
		//右へいく場合
		for(int r = X;r<=N;r++){
			if(A.contains(r))countR++;
		}

		System.out.println(Math.min(countL,countR));
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tmp = br.readLine().split(" ");
		int N = Integer.parseInt(tmp[0]);
		int M = Integer.parseInt(tmp[1]);
		int X = Integer.parseInt(tmp[2]);
		List<Integer> A = new ArrayList<Integer>();
		tmp = br.readLine().split(" ");
		for(int i = 0;i<M;i++){
			A.add(Integer.parseInt(tmp[i]));
		}
		int countL = 0;
		int countR = 0;
		//左へ行く場合
		for(int l = X;l>0;l--){
			if(A.contains(l))countL++;
		}
		//右へいく場合
		for(int r = X;r<=N;r++){
			if(A.contains(r))countR++;
		}

		System.out.println(Math.min(countL,countR));
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] tmp = br.readLine().split(" "); tmp br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int N = Integer.parseInt(tmp[0]); N Integer.parseInt(tmp[0]) Integer.parseInt Integer tmp[0] tmp 0 int M = Integer.parseInt(tmp[1]); M Integer.parseInt(tmp[1]) Integer.parseInt Integer tmp[1] tmp 1 int X = Integer.parseInt(tmp[2]); X Integer.parseInt(tmp[2]) Integer.parseInt Integer tmp[2] tmp 2 List<Integer> A = new ArrayList<Integer>(); A new ArrayList<Integer>() tmp = br.readLine().split(" ") tmp br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i = 0;i<M;i++){
			A.add(Integer.parseInt(tmp[i]));
		} int i = 0; int i = 0; i 0 i<M i M i++ i++ i {
			A.add(Integer.parseInt(tmp[i]));
		} {
			A.add(Integer.parseInt(tmp[i]));
		} A.add(Integer.parseInt(tmp[i])) A.add A Integer.parseInt(tmp[i]) Integer.parseInt Integer tmp[i] tmp i int countL = 0; countL 0 int countR = 0; countR 0 for(int l = X;l>0;l--){
			if(A.contains(l))countL++;
		} int l = X; int l = X; l X l>0 l 0 l-- l-- l {
			if(A.contains(l))countL++;
		} {
			if(A.contains(l))countL++;
		} if(A.contains(l))countL++; A.contains(l) A.contains A l countL++ countL for(int r = X;r<=N;r++){
			if(A.contains(r))countR++;
		} int r = X; int r = X; r X r<=N r N r++ r++ r {
			if(A.contains(r))countR++;
		} {
			if(A.contains(r))countR++;
		} if(A.contains(r))countR++; A.contains(r) A.contains A r countR++ countR System.out.println(Math.min(countL,countR)) System.out.println System.out System System.out Math.min(countL,countR) Math.min Math countL countR String[] args args public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tmp = br.readLine().split(" ");
		int N = Integer.parseInt(tmp[0]);
		int M = Integer.parseInt(tmp[1]);
		int X = Integer.parseInt(tmp[2]);
		List<Integer> A = new ArrayList<Integer>();
		tmp = br.readLine().split(" ");
		for(int i = 0;i<M;i++){
			A.add(Integer.parseInt(tmp[i]));
		}
		int countL = 0;
		int countR = 0;
		//左へ行く場合
		for(int l = X;l>0;l--){
			if(A.contains(l))countL++;
		}
		//右へいく場合
		for(int r = X;r<=N;r++){
			if(A.contains(r))countR++;
		}

		System.out.println(Math.min(countL,countR));
	}


} public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tmp = br.readLine().split(" ");
		int N = Integer.parseInt(tmp[0]);
		int M = Integer.parseInt(tmp[1]);
		int X = Integer.parseInt(tmp[2]);
		List<Integer> A = new ArrayList<Integer>();
		tmp = br.readLine().split(" ");
		for(int i = 0;i<M;i++){
			A.add(Integer.parseInt(tmp[i]));
		}
		int countL = 0;
		int countR = 0;
		//左へ行く場合
		for(int l = X;l>0;l--){
			if(A.contains(l))countL++;
		}
		//右へいく場合
		for(int r = X;r<=N;r++){
			if(A.contains(r))countR++;
		}

		System.out.println(Math.min(countL,countR));
	}


} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tmp = br.readLine().split(" ");
		int N = Integer.parseInt(tmp[0]);
		int M = Integer.parseInt(tmp[1]);
		int X = Integer.parseInt(tmp[2]);
		List<Integer> A = new ArrayList<Integer>();
		tmp = br.readLine().split(" ");
		for(int i = 0;i<M;i++){
			A.add(Integer.parseInt(tmp[i]));
		}
		int countL = 0;
		int countR = 0;
		//左へ行く場合
		for(int l = X;l>0;l--){
			if(A.contains(l))countL++;
		}
		//右へいく場合
		for(int r = X;r<=N;r++){
			if(A.contains(r))countR++;
		}

		System.out.println(Math.min(countL,countR));
	}


}
