import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		int[] masu = new int[n];
		int to0 = 0, toN = 0;

		for (int i = 0; i < m; i++) {
			masu[sc.nextInt()] = -1;
		}

		for (int i = x; i < n; i++) {
			if (masu[i] == -1) {
				toN++;
			}
		}

		for (int i = x; i > 0; i--) {
			if (masu[i] == -1) {
				to0++;
			}
		}

		System.out.print(Math.min(toN, to0));
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		int[] masu = new int[n];
		int to0 = 0, toN = 0;

		for (int i = 0; i < m; i++) {
			masu[sc.nextInt()] = -1;
		}

		for (int i = x; i < n; i++) {
			if (masu[i] == -1) {
				toN++;
			}
		}

		for (int i = x; i > 0; i--) {
			if (masu[i] == -1) {
				to0++;
			}
		}

		System.out.print(Math.min(toN, to0));
	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		int[] masu = new int[n];
		int to0 = 0, toN = 0;

		for (int i = 0; i < m; i++) {
			masu[sc.nextInt()] = -1;
		}

		for (int i = x; i < n; i++) {
			if (masu[i] == -1) {
				toN++;
			}
		}

		for (int i = x; i > 0; i--) {
			if (masu[i] == -1) {
				to0++;
			}
		}

		System.out.print(Math.min(toN, to0));
	} main {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		int[] masu = new int[n];
		int to0 = 0, toN = 0;

		for (int i = 0; i < m; i++) {
			masu[sc.nextInt()] = -1;
		}

		for (int i = x; i < n; i++) {
			if (masu[i] == -1) {
				toN++;
			}
		}

		for (int i = x; i > 0; i--) {
			if (masu[i] == -1) {
				to0++;
			}
		}

		System.out.print(Math.min(toN, to0));
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.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[] masu = new int[n]; masu new int[n] n int to0 = 0 to0 0 toN = 0; toN 0 for (int i = 0; i < m; i++) {
			masu[sc.nextInt()] = -1;
		} int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
			masu[sc.nextInt()] = -1;
		} {
			masu[sc.nextInt()] = -1;
		} masu[sc.nextInt()] = -1 masu[sc.nextInt()] masu sc.nextInt() sc.nextInt sc -1 1 for (int i = x; i < n; i++) {
			if (masu[i] == -1) {
				toN++;
			}
		} int i = x; int i = x; i x i < n i n i++ i++ i {
			if (masu[i] == -1) {
				toN++;
			}
		} {
			if (masu[i] == -1) {
				toN++;
			}
		} if (masu[i] == -1) {
				toN++;
			} masu[i] == -1 masu[i] masu i -1 1 {
				toN++;
			} toN++ toN for (int i = x; i > 0; i--) {
			if (masu[i] == -1) {
				to0++;
			}
		} int i = x; int i = x; i x i > 0 i 0 i-- i-- i {
			if (masu[i] == -1) {
				to0++;
			}
		} {
			if (masu[i] == -1) {
				to0++;
			}
		} if (masu[i] == -1) {
				to0++;
			} masu[i] == -1 masu[i] masu i -1 1 {
				to0++;
			} to0++ to0 System.out.print(Math.min(toN, to0)) System.out.print System.out System System.out Math.min(toN, to0) Math.min Math toN to0 String[] args args public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		int[] masu = new int[n];
		int to0 = 0, toN = 0;

		for (int i = 0; i < m; i++) {
			masu[sc.nextInt()] = -1;
		}

		for (int i = x; i < n; i++) {
			if (masu[i] == -1) {
				toN++;
			}
		}

		for (int i = x; i > 0; i--) {
			if (masu[i] == -1) {
				to0++;
			}
		}

		System.out.print(Math.min(toN, to0));
	}
} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		int[] masu = new int[n];
		int to0 = 0, toN = 0;

		for (int i = 0; i < m; i++) {
			masu[sc.nextInt()] = -1;
		}

		for (int i = x; i < n; i++) {
			if (masu[i] == -1) {
				toN++;
			}
		}

		for (int i = x; i > 0; i--) {
			if (masu[i] == -1) {
				to0++;
			}
		}

		System.out.print(Math.min(toN, to0));
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		int[] masu = new int[n];
		int to0 = 0, toN = 0;

		for (int i = 0; i < m; i++) {
			masu[sc.nextInt()] = -1;
		}

		for (int i = x; i < n; i++) {
			if (masu[i] == -1) {
				toN++;
			}
		}

		for (int i = x; i > 0; i--) {
			if (masu[i] == -1) {
				to0++;
			}
		}

		System.out.print(Math.min(toN, to0));
	}
}