import java.util.Scanner;

public class Main {

	static int[] costMasuList;

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		try {
			String[] inputTmp = scanner.nextLine().split(" ");
			int masuLength = Integer.parseInt(inputTmp[0]);
			int costMasuLength = Integer.parseInt(inputTmp[1]);
			int startMasu = Integer.parseInt(inputTmp[2]);
			costMasuList = new int[costMasuLength];
			for (int i=0;i < costMasuLength;i++) {
				costMasuList[i] = scanner.nextInt();
			}

			int startLeftCost = 0;
			int startRightCost = 0;
			for (int i = 1; i < masuLength; i++) {
				if (!isCostMasu(i)) {
					continue;
				}
				if (i < startMasu) {
					startLeftCost++;
				} else if (i > startMasu) {
					startRightCost++;
				}
			}

			System.out.print(startLeftCost < startRightCost ? startLeftCost : startRightCost);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			scanner.close();
		}
	}

	private static boolean isCostMasu(int input) {
		for (int i = 0; i < costMasuList.length; i++) {
			if (costMasuList[i] == input) {
				return true;
			}
		}
		return false;
	}
} import java.util.Scanner; Scanner java.util public class Main {

	static int[] costMasuList;

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		try {
			String[] inputTmp = scanner.nextLine().split(" ");
			int masuLength = Integer.parseInt(inputTmp[0]);
			int costMasuLength = Integer.parseInt(inputTmp[1]);
			int startMasu = Integer.parseInt(inputTmp[2]);
			costMasuList = new int[costMasuLength];
			for (int i=0;i < costMasuLength;i++) {
				costMasuList[i] = scanner.nextInt();
			}

			int startLeftCost = 0;
			int startRightCost = 0;
			for (int i = 1; i < masuLength; i++) {
				if (!isCostMasu(i)) {
					continue;
				}
				if (i < startMasu) {
					startLeftCost++;
				} else if (i > startMasu) {
					startRightCost++;
				}
			}

			System.out.print(startLeftCost < startRightCost ? startLeftCost : startRightCost);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			scanner.close();
		}
	}

	private static boolean isCostMasu(int input) {
		for (int i = 0; i < costMasuList.length; i++) {
			if (costMasuList[i] == input) {
				return true;
			}
		}
		return false;
	}
} Main static int[] costMasuList; costMasuList public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		try {
			String[] inputTmp = scanner.nextLine().split(" ");
			int masuLength = Integer.parseInt(inputTmp[0]);
			int costMasuLength = Integer.parseInt(inputTmp[1]);
			int startMasu = Integer.parseInt(inputTmp[2]);
			costMasuList = new int[costMasuLength];
			for (int i=0;i < costMasuLength;i++) {
				costMasuList[i] = scanner.nextInt();
			}

			int startLeftCost = 0;
			int startRightCost = 0;
			for (int i = 1; i < masuLength; i++) {
				if (!isCostMasu(i)) {
					continue;
				}
				if (i < startMasu) {
					startLeftCost++;
				} else if (i > startMasu) {
					startRightCost++;
				}
			}

			System.out.print(startLeftCost < startRightCost ? startLeftCost : startRightCost);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			scanner.close();
		}
	} main {
		Scanner scanner = new Scanner(System.in);
		try {
			String[] inputTmp = scanner.nextLine().split(" ");
			int masuLength = Integer.parseInt(inputTmp[0]);
			int costMasuLength = Integer.parseInt(inputTmp[1]);
			int startMasu = Integer.parseInt(inputTmp[2]);
			costMasuList = new int[costMasuLength];
			for (int i=0;i < costMasuLength;i++) {
				costMasuList[i] = scanner.nextInt();
			}

			int startLeftCost = 0;
			int startRightCost = 0;
			for (int i = 1; i < masuLength; i++) {
				if (!isCostMasu(i)) {
					continue;
				}
				if (i < startMasu) {
					startLeftCost++;
				} else if (i > startMasu) {
					startRightCost++;
				}
			}

			System.out.print(startLeftCost < startRightCost ? startLeftCost : startRightCost);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			scanner.close();
		}
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) try {
			String[] inputTmp = scanner.nextLine().split(" ");
			int masuLength = Integer.parseInt(inputTmp[0]);
			int costMasuLength = Integer.parseInt(inputTmp[1]);
			int startMasu = Integer.parseInt(inputTmp[2]);
			costMasuList = new int[costMasuLength];
			for (int i=0;i < costMasuLength;i++) {
				costMasuList[i] = scanner.nextInt();
			}

			int startLeftCost = 0;
			int startRightCost = 0;
			for (int i = 1; i < masuLength; i++) {
				if (!isCostMasu(i)) {
					continue;
				}
				if (i < startMasu) {
					startLeftCost++;
				} else if (i > startMasu) {
					startRightCost++;
				}
			}

			System.out.print(startLeftCost < startRightCost ? startLeftCost : startRightCost);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			scanner.close();
		} catch (Exception e) {
			e.printStackTrace();
		} Exception e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			scanner.close();
		} scanner.close() scanner.close scanner {
			String[] inputTmp = scanner.nextLine().split(" ");
			int masuLength = Integer.parseInt(inputTmp[0]);
			int costMasuLength = Integer.parseInt(inputTmp[1]);
			int startMasu = Integer.parseInt(inputTmp[2]);
			costMasuList = new int[costMasuLength];
			for (int i=0;i < costMasuLength;i++) {
				costMasuList[i] = scanner.nextInt();
			}

			int startLeftCost = 0;
			int startRightCost = 0;
			for (int i = 1; i < masuLength; i++) {
				if (!isCostMasu(i)) {
					continue;
				}
				if (i < startMasu) {
					startLeftCost++;
				} else if (i > startMasu) {
					startRightCost++;
				}
			}

			System.out.print(startLeftCost < startRightCost ? startLeftCost : startRightCost);
		} String[] inputTmp = scanner.nextLine().split(" "); inputTmp scanner.nextLine().split(" ") scanner.nextLine().split scanner.nextLine() scanner.nextLine scanner " " int masuLength = Integer.parseInt(inputTmp[0]); masuLength Integer.parseInt(inputTmp[0]) Integer.parseInt Integer inputTmp[0] inputTmp 0 int costMasuLength = Integer.parseInt(inputTmp[1]); costMasuLength Integer.parseInt(inputTmp[1]) Integer.parseInt Integer inputTmp[1] inputTmp 1 int startMasu = Integer.parseInt(inputTmp[2]); startMasu Integer.parseInt(inputTmp[2]) Integer.parseInt Integer inputTmp[2] inputTmp 2 costMasuList = new int[costMasuLength] costMasuList new int[costMasuLength] costMasuLength for (int i=0;i < costMasuLength;i++) {
				costMasuList[i] = scanner.nextInt();
			} int i=0; int i=0; i 0 i < costMasuLength i costMasuLength i++ i++ i {
				costMasuList[i] = scanner.nextInt();
			} {
				costMasuList[i] = scanner.nextInt();
			} costMasuList[i] = scanner.nextInt() costMasuList[i] costMasuList i scanner.nextInt() scanner.nextInt scanner int startLeftCost = 0; startLeftCost 0 int startRightCost = 0; startRightCost 0 for (int i = 1; i < masuLength; i++) {
				if (!isCostMasu(i)) {
					continue;
				}
				if (i < startMasu) {
					startLeftCost++;
				} else if (i > startMasu) {
					startRightCost++;
				}
			} int i = 1; int i = 1; i 1 i < masuLength i masuLength i++ i++ i {
				if (!isCostMasu(i)) {
					continue;
				}
				if (i < startMasu) {
					startLeftCost++;
				} else if (i > startMasu) {
					startRightCost++;
				}
			} {
				if (!isCostMasu(i)) {
					continue;
				}
				if (i < startMasu) {
					startLeftCost++;
				} else if (i > startMasu) {
					startRightCost++;
				}
			} if (!isCostMasu(i)) {
					continue;
				} !isCostMasu(i) isCostMasu(i) isCostMasu i {
					continue;
				} continue; if (i < startMasu) {
					startLeftCost++;
				} else if (i > startMasu) {
					startRightCost++;
				} i < startMasu i startMasu {
					startLeftCost++;
				} startLeftCost++ startLeftCost if (i > startMasu) {
					startRightCost++;
				} i > startMasu i startMasu {
					startRightCost++;
				} startRightCost++ startRightCost System.out.print(startLeftCost < startRightCost ? startLeftCost : startRightCost) System.out.print System.out System System.out startLeftCost < startRightCost ? startLeftCost : startRightCost startLeftCost < startRightCost startLeftCost startRightCost startLeftCost startRightCost String[] args args private static boolean isCostMasu(int input) {
		for (int i = 0; i < costMasuList.length; i++) {
			if (costMasuList[i] == input) {
				return true;
			}
		}
		return false;
	} isCostMasu {
		for (int i = 0; i < costMasuList.length; i++) {
			if (costMasuList[i] == input) {
				return true;
			}
		}
		return false;
	} for (int i = 0; i < costMasuList.length; i++) {
			if (costMasuList[i] == input) {
				return true;
			}
		} int i = 0; int i = 0; i 0 i < costMasuList.length i costMasuList.length costMasuList costMasuList.length i++ i++ i {
			if (costMasuList[i] == input) {
				return true;
			}
		} {
			if (costMasuList[i] == input) {
				return true;
			}
		} if (costMasuList[i] == input) {
				return true;
			} costMasuList[i] == input costMasuList[i] costMasuList i input {
				return true;
			} return true; true return false; false int input input public class Main {

	static int[] costMasuList;

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		try {
			String[] inputTmp = scanner.nextLine().split(" ");
			int masuLength = Integer.parseInt(inputTmp[0]);
			int costMasuLength = Integer.parseInt(inputTmp[1]);
			int startMasu = Integer.parseInt(inputTmp[2]);
			costMasuList = new int[costMasuLength];
			for (int i=0;i < costMasuLength;i++) {
				costMasuList[i] = scanner.nextInt();
			}

			int startLeftCost = 0;
			int startRightCost = 0;
			for (int i = 1; i < masuLength; i++) {
				if (!isCostMasu(i)) {
					continue;
				}
				if (i < startMasu) {
					startLeftCost++;
				} else if (i > startMasu) {
					startRightCost++;
				}
			}

			System.out.print(startLeftCost < startRightCost ? startLeftCost : startRightCost);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			scanner.close();
		}
	}

	private static boolean isCostMasu(int input) {
		for (int i = 0; i < costMasuList.length; i++) {
			if (costMasuList[i] == input) {
				return true;
			}
		}
		return false;
	}
} public class Main {

	static int[] costMasuList;

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		try {
			String[] inputTmp = scanner.nextLine().split(" ");
			int masuLength = Integer.parseInt(inputTmp[0]);
			int costMasuLength = Integer.parseInt(inputTmp[1]);
			int startMasu = Integer.parseInt(inputTmp[2]);
			costMasuList = new int[costMasuLength];
			for (int i=0;i < costMasuLength;i++) {
				costMasuList[i] = scanner.nextInt();
			}

			int startLeftCost = 0;
			int startRightCost = 0;
			for (int i = 1; i < masuLength; i++) {
				if (!isCostMasu(i)) {
					continue;
				}
				if (i < startMasu) {
					startLeftCost++;
				} else if (i > startMasu) {
					startRightCost++;
				}
			}

			System.out.print(startLeftCost < startRightCost ? startLeftCost : startRightCost);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			scanner.close();
		}
	}

	private static boolean isCostMasu(int input) {
		for (int i = 0; i < costMasuList.length; i++) {
			if (costMasuList[i] == input) {
				return true;
			}
		}
		return false;
	}
} Main
import java.util.Scanner;

public class Main {

	static int[] costMasuList;

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		try {
			String[] inputTmp = scanner.nextLine().split(" ");
			int masuLength = Integer.parseInt(inputTmp[0]);
			int costMasuLength = Integer.parseInt(inputTmp[1]);
			int startMasu = Integer.parseInt(inputTmp[2]);
			costMasuList = new int[costMasuLength];
			for (int i=0;i < costMasuLength;i++) {
				costMasuList[i] = scanner.nextInt();
			}

			int startLeftCost = 0;
			int startRightCost = 0;
			for (int i = 1; i < masuLength; i++) {
				if (!isCostMasu(i)) {
					continue;
				}
				if (i < startMasu) {
					startLeftCost++;
				} else if (i > startMasu) {
					startRightCost++;
				}
			}

			System.out.print(startLeftCost < startRightCost ? startLeftCost : startRightCost);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			scanner.close();
		}
	}

	private static boolean isCostMasu(int input) {
		for (int i = 0; i < costMasuList.length; i++) {
			if (costMasuList[i] == input) {
				return true;
			}
		}
		return false;
	}
}
