import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		int M = input.nextInt();
		int START = input.nextInt();
		int C1 = 0;
		int C2 = 0;
		int[] toll = new int[M];
		for (int i = 0; i < M; i++) {
			toll[i] = input.nextInt();
		}
		for (int i = START+1; i<=N; i++) {
			for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C1++;
					break;
				}
			}
		}
		for (int i = START-1; i>=0; i--) {
			for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C2++;
					break;
				}
			}
		}
		System.out.println(Math.min(C1, C2));
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		int M = input.nextInt();
		int START = input.nextInt();
		int C1 = 0;
		int C2 = 0;
		int[] toll = new int[M];
		for (int i = 0; i < M; i++) {
			toll[i] = input.nextInt();
		}
		for (int i = START+1; i<=N; i++) {
			for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C1++;
					break;
				}
			}
		}
		for (int i = START-1; i>=0; i--) {
			for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C2++;
					break;
				}
			}
		}
		System.out.println(Math.min(C1, C2));
	}
} Main public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		int M = input.nextInt();
		int START = input.nextInt();
		int C1 = 0;
		int C2 = 0;
		int[] toll = new int[M];
		for (int i = 0; i < M; i++) {
			toll[i] = input.nextInt();
		}
		for (int i = START+1; i<=N; i++) {
			for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C1++;
					break;
				}
			}
		}
		for (int i = START-1; i>=0; i--) {
			for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C2++;
					break;
				}
			}
		}
		System.out.println(Math.min(C1, C2));
	} main {
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		int M = input.nextInt();
		int START = input.nextInt();
		int C1 = 0;
		int C2 = 0;
		int[] toll = new int[M];
		for (int i = 0; i < M; i++) {
			toll[i] = input.nextInt();
		}
		for (int i = START+1; i<=N; i++) {
			for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C1++;
					break;
				}
			}
		}
		for (int i = START-1; i>=0; i--) {
			for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C2++;
					break;
				}
			}
		}
		System.out.println(Math.min(C1, C2));
	} Scanner input = new Scanner(System.in); input new Scanner(System.in) int N = input.nextInt(); N input.nextInt() input.nextInt input int M = input.nextInt(); M input.nextInt() input.nextInt input int START = input.nextInt(); START input.nextInt() input.nextInt input int C1 = 0; C1 0 int C2 = 0; C2 0 int[] toll = new int[M]; toll new int[M] M for (int i = 0; i < M; i++) {
			toll[i] = input.nextInt();
		} int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
			toll[i] = input.nextInt();
		} {
			toll[i] = input.nextInt();
		} toll[i] = input.nextInt() toll[i] toll i input.nextInt() input.nextInt input for (int i = START+1; i<=N; i++) {
			for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C1++;
					break;
				}
			}
		} int i = START+1; int i = START+1; i START+1 START 1 i<=N i N i++ i++ i {
			for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C1++;
					break;
				}
			}
		} {
			for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C1++;
					break;
				}
			}
		} for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C1++;
					break;
				}
			} int check = 0; int check = 0; check 0 check < M check M check++ check++ check {
				if (i==toll[check]) {
					C1++;
					break;
				}
			} {
				if (i==toll[check]) {
					C1++;
					break;
				}
			} if (i==toll[check]) {
					C1++;
					break;
				} i==toll[check] i toll[check] toll check {
					C1++;
					break;
				} C1++ C1 break; for (int i = START-1; i>=0; i--) {
			for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C2++;
					break;
				}
			}
		} int i = START-1; int i = START-1; i START-1 START 1 i>=0 i 0 i-- i-- i {
			for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C2++;
					break;
				}
			}
		} {
			for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C2++;
					break;
				}
			}
		} for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C2++;
					break;
				}
			} int check = 0; int check = 0; check 0 check < M check M check++ check++ check {
				if (i==toll[check]) {
					C2++;
					break;
				}
			} {
				if (i==toll[check]) {
					C2++;
					break;
				}
			} if (i==toll[check]) {
					C2++;
					break;
				} i==toll[check] i toll[check] toll check {
					C2++;
					break;
				} C2++ C2 break; System.out.println(Math.min(C1, C2)) System.out.println System.out System System.out Math.min(C1, C2) Math.min Math C1 C2 String[] args args public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		int M = input.nextInt();
		int START = input.nextInt();
		int C1 = 0;
		int C2 = 0;
		int[] toll = new int[M];
		for (int i = 0; i < M; i++) {
			toll[i] = input.nextInt();
		}
		for (int i = START+1; i<=N; i++) {
			for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C1++;
					break;
				}
			}
		}
		for (int i = START-1; i>=0; i--) {
			for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C2++;
					break;
				}
			}
		}
		System.out.println(Math.min(C1, C2));
	}
} public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		int M = input.nextInt();
		int START = input.nextInt();
		int C1 = 0;
		int C2 = 0;
		int[] toll = new int[M];
		for (int i = 0; i < M; i++) {
			toll[i] = input.nextInt();
		}
		for (int i = START+1; i<=N; i++) {
			for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C1++;
					break;
				}
			}
		}
		for (int i = START-1; i>=0; i--) {
			for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C2++;
					break;
				}
			}
		}
		System.out.println(Math.min(C1, C2));
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		int M = input.nextInt();
		int START = input.nextInt();
		int C1 = 0;
		int C2 = 0;
		int[] toll = new int[M];
		for (int i = 0; i < M; i++) {
			toll[i] = input.nextInt();
		}
		for (int i = START+1; i<=N; i++) {
			for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C1++;
					break;
				}
			}
		}
		for (int i = START-1; i>=0; i--) {
			for (int check = 0; check < M; check++) {
				if (i==toll[check]) {
					C2++;
					break;
				}
			}
		}
		System.out.println(Math.min(C1, C2));
	}
}