import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int m = s.nextInt();
		int x = s.nextInt();
		char[] road = new char[n];
		int countFromStart = 0;
		int countToEnd = 0;
		int countC = 0;

		Arrays.fill(road, 'a');
		road[x] = 'x';

		for (int i = 0; i < m; i++) {
			int tmp = s.nextInt();
			road[tmp] = 'c';
		}
		for (int j = 0; j < x; j++) {
			if (road[j] == 'c') {
				++countFromStart;
			}
		}
		for (int k = x + 1; k < n; k++) {
			if (road[k] == 'c') {
				++countToEnd;
			}
		}

		if (countToEnd > countFromStart) {
			for (int p = 0; p < x; p++) {
				if (road[p] == 'c')
					++countC;
			}
		} else {
			for (int q = x + 1; q <n; q++) {
				if (road[q] == 'c') {
					++countC;
				}
			}
		}
		System.out.println(countC);
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int m = s.nextInt();
		int x = s.nextInt();
		char[] road = new char[n];
		int countFromStart = 0;
		int countToEnd = 0;
		int countC = 0;

		Arrays.fill(road, 'a');
		road[x] = 'x';

		for (int i = 0; i < m; i++) {
			int tmp = s.nextInt();
			road[tmp] = 'c';
		}
		for (int j = 0; j < x; j++) {
			if (road[j] == 'c') {
				++countFromStart;
			}
		}
		for (int k = x + 1; k < n; k++) {
			if (road[k] == 'c') {
				++countToEnd;
			}
		}

		if (countToEnd > countFromStart) {
			for (int p = 0; p < x; p++) {
				if (road[p] == 'c')
					++countC;
			}
		} else {
			for (int q = x + 1; q <n; q++) {
				if (road[q] == 'c') {
					++countC;
				}
			}
		}
		System.out.println(countC);
	}
} Main public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int m = s.nextInt();
		int x = s.nextInt();
		char[] road = new char[n];
		int countFromStart = 0;
		int countToEnd = 0;
		int countC = 0;

		Arrays.fill(road, 'a');
		road[x] = 'x';

		for (int i = 0; i < m; i++) {
			int tmp = s.nextInt();
			road[tmp] = 'c';
		}
		for (int j = 0; j < x; j++) {
			if (road[j] == 'c') {
				++countFromStart;
			}
		}
		for (int k = x + 1; k < n; k++) {
			if (road[k] == 'c') {
				++countToEnd;
			}
		}

		if (countToEnd > countFromStart) {
			for (int p = 0; p < x; p++) {
				if (road[p] == 'c')
					++countC;
			}
		} else {
			for (int q = x + 1; q <n; q++) {
				if (road[q] == 'c') {
					++countC;
				}
			}
		}
		System.out.println(countC);
	} main {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int m = s.nextInt();
		int x = s.nextInt();
		char[] road = new char[n];
		int countFromStart = 0;
		int countToEnd = 0;
		int countC = 0;

		Arrays.fill(road, 'a');
		road[x] = 'x';

		for (int i = 0; i < m; i++) {
			int tmp = s.nextInt();
			road[tmp] = 'c';
		}
		for (int j = 0; j < x; j++) {
			if (road[j] == 'c') {
				++countFromStart;
			}
		}
		for (int k = x + 1; k < n; k++) {
			if (road[k] == 'c') {
				++countToEnd;
			}
		}

		if (countToEnd > countFromStart) {
			for (int p = 0; p < x; p++) {
				if (road[p] == 'c')
					++countC;
			}
		} else {
			for (int q = x + 1; q <n; q++) {
				if (road[q] == 'c') {
					++countC;
				}
			}
		}
		System.out.println(countC);
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) int n = s.nextInt(); n s.nextInt() s.nextInt s int m = s.nextInt(); m s.nextInt() s.nextInt s int x = s.nextInt(); x s.nextInt() s.nextInt s char[] road = new char[n]; road new char[n] n int countFromStart = 0; countFromStart 0 int countToEnd = 0; countToEnd 0 int countC = 0; countC 0 Arrays.fill(road, 'a') Arrays.fill Arrays road 'a' road[x] = 'x' road[x] road x 'x' for (int i = 0; i < m; i++) {
			int tmp = s.nextInt();
			road[tmp] = 'c';
		} int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
			int tmp = s.nextInt();
			road[tmp] = 'c';
		} {
			int tmp = s.nextInt();
			road[tmp] = 'c';
		} int tmp = s.nextInt(); tmp s.nextInt() s.nextInt s road[tmp] = 'c' road[tmp] road tmp 'c' for (int j = 0; j < x; j++) {
			if (road[j] == 'c') {
				++countFromStart;
			}
		} int j = 0; int j = 0; j 0 j < x j x j++ j++ j {
			if (road[j] == 'c') {
				++countFromStart;
			}
		} {
			if (road[j] == 'c') {
				++countFromStart;
			}
		} if (road[j] == 'c') {
				++countFromStart;
			} road[j] == 'c' road[j] road j 'c' {
				++countFromStart;
			} ++countFromStart countFromStart for (int k = x + 1; k < n; k++) {
			if (road[k] == 'c') {
				++countToEnd;
			}
		} int k = x + 1; int k = x + 1; k x + 1 x 1 k < n k n k++ k++ k {
			if (road[k] == 'c') {
				++countToEnd;
			}
		} {
			if (road[k] == 'c') {
				++countToEnd;
			}
		} if (road[k] == 'c') {
				++countToEnd;
			} road[k] == 'c' road[k] road k 'c' {
				++countToEnd;
			} ++countToEnd countToEnd if (countToEnd > countFromStart) {
			for (int p = 0; p < x; p++) {
				if (road[p] == 'c')
					++countC;
			}
		} else {
			for (int q = x + 1; q <n; q++) {
				if (road[q] == 'c') {
					++countC;
				}
			}
		} countToEnd > countFromStart countToEnd countFromStart {
			for (int p = 0; p < x; p++) {
				if (road[p] == 'c')
					++countC;
			}
		} for (int p = 0; p < x; p++) {
				if (road[p] == 'c')
					++countC;
			} int p = 0; int p = 0; p 0 p < x p x p++ p++ p {
				if (road[p] == 'c')
					++countC;
			} {
				if (road[p] == 'c')
					++countC;
			} if (road[p] == 'c')
					++countC; road[p] == 'c' road[p] road p 'c' ++countC countC {
			for (int q = x + 1; q <n; q++) {
				if (road[q] == 'c') {
					++countC;
				}
			}
		} for (int q = x + 1; q <n; q++) {
				if (road[q] == 'c') {
					++countC;
				}
			} int q = x + 1; int q = x + 1; q x + 1 x 1 q <n q n q++ q++ q {
				if (road[q] == 'c') {
					++countC;
				}
			} {
				if (road[q] == 'c') {
					++countC;
				}
			} if (road[q] == 'c') {
					++countC;
				} road[q] == 'c' road[q] road q 'c' {
					++countC;
				} ++countC countC System.out.println(countC) System.out.println System.out System System.out countC String[] args args public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int m = s.nextInt();
		int x = s.nextInt();
		char[] road = new char[n];
		int countFromStart = 0;
		int countToEnd = 0;
		int countC = 0;

		Arrays.fill(road, 'a');
		road[x] = 'x';

		for (int i = 0; i < m; i++) {
			int tmp = s.nextInt();
			road[tmp] = 'c';
		}
		for (int j = 0; j < x; j++) {
			if (road[j] == 'c') {
				++countFromStart;
			}
		}
		for (int k = x + 1; k < n; k++) {
			if (road[k] == 'c') {
				++countToEnd;
			}
		}

		if (countToEnd > countFromStart) {
			for (int p = 0; p < x; p++) {
				if (road[p] == 'c')
					++countC;
			}
		} else {
			for (int q = x + 1; q <n; q++) {
				if (road[q] == 'c') {
					++countC;
				}
			}
		}
		System.out.println(countC);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int m = s.nextInt();
		int x = s.nextInt();
		char[] road = new char[n];
		int countFromStart = 0;
		int countToEnd = 0;
		int countC = 0;

		Arrays.fill(road, 'a');
		road[x] = 'x';

		for (int i = 0; i < m; i++) {
			int tmp = s.nextInt();
			road[tmp] = 'c';
		}
		for (int j = 0; j < x; j++) {
			if (road[j] == 'c') {
				++countFromStart;
			}
		}
		for (int k = x + 1; k < n; k++) {
			if (road[k] == 'c') {
				++countToEnd;
			}
		}

		if (countToEnd > countFromStart) {
			for (int p = 0; p < x; p++) {
				if (road[p] == 'c')
					++countC;
			}
		} else {
			for (int q = x + 1; q <n; q++) {
				if (road[q] == 'c') {
					++countC;
				}
			}
		}
		System.out.println(countC);
	}
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int m = s.nextInt();
		int x = s.nextInt();
		char[] road = new char[n];
		int countFromStart = 0;
		int countToEnd = 0;
		int countC = 0;

		Arrays.fill(road, 'a');
		road[x] = 'x';

		for (int i = 0; i < m; i++) {
			int tmp = s.nextInt();
			road[tmp] = 'c';
		}
		for (int j = 0; j < x; j++) {
			if (road[j] == 'c') {
				++countFromStart;
			}
		}
		for (int k = x + 1; k < n; k++) {
			if (road[k] == 'c') {
				++countToEnd;
			}
		}

		if (countToEnd > countFromStart) {
			for (int p = 0; p < x; p++) {
				if (road[p] == 'c')
					++countC;
			}
		} else {
			for (int q = x + 1; q <n; q++) {
				if (road[q] == 'c') {
					++countC;
				}
			}
		}
		System.out.println(countC);
	}
}
