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 a[] = new int[M];
		for (int i = 0; i < M; i++) {
			a[i] = sc.nextInt();
		}

		int c1 = 0;
		int c2 = 0;

		int n = X;
		while(X != 0) {
			X--;
			for (int i = 0; i < M; i++) {
				if (X == a[i]) {
					c1++;
				}
			}
		}

		X = n;
		while(X != N) {
			X++;
			for (int i = 0; i < M; i++) {
				if (X == a[i]) {
					c2++;
				}
			}
		}

		if (c1 <= c2) {
			System.out.println(c1);
		} else {
			System.out.println(c2);
		}

	}

} 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 a[] = new int[M];
		for (int i = 0; i < M; i++) {
			a[i] = sc.nextInt();
		}

		int c1 = 0;
		int c2 = 0;

		int n = X;
		while(X != 0) {
			X--;
			for (int i = 0; i < M; i++) {
				if (X == a[i]) {
					c1++;
				}
			}
		}

		X = n;
		while(X != N) {
			X++;
			for (int i = 0; i < M; i++) {
				if (X == a[i]) {
					c2++;
				}
			}
		}

		if (c1 <= c2) {
			System.out.println(c1);
		} else {
			System.out.println(c2);
		}

	}

} 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 a[] = new int[M];
		for (int i = 0; i < M; i++) {
			a[i] = sc.nextInt();
		}

		int c1 = 0;
		int c2 = 0;

		int n = X;
		while(X != 0) {
			X--;
			for (int i = 0; i < M; i++) {
				if (X == a[i]) {
					c1++;
				}
			}
		}

		X = n;
		while(X != N) {
			X++;
			for (int i = 0; i < M; i++) {
				if (X == a[i]) {
					c2++;
				}
			}
		}

		if (c1 <= c2) {
			System.out.println(c1);
		} else {
			System.out.println(c2);
		}

	} main {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();

		int a[] = new int[M];
		for (int i = 0; i < M; i++) {
			a[i] = sc.nextInt();
		}

		int c1 = 0;
		int c2 = 0;

		int n = X;
		while(X != 0) {
			X--;
			for (int i = 0; i < M; i++) {
				if (X == a[i]) {
					c1++;
				}
			}
		}

		X = n;
		while(X != N) {
			X++;
			for (int i = 0; i < M; i++) {
				if (X == a[i]) {
					c2++;
				}
			}
		}

		if (c1 <= c2) {
			System.out.println(c1);
		} else {
			System.out.println(c2);
		}

	} 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 a[] = new int[M]; a new int[M] M for (int i = 0; i < M; i++) {
			a[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
			a[i] = sc.nextInt();
		} {
			a[i] = sc.nextInt();
		} a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc int c1 = 0; c1 0 int c2 = 0; c2 0 int n = X; n X while(X != 0) {
			X--;
			for (int i = 0; i < M; i++) {
				if (X == a[i]) {
					c1++;
				}
			}
		} X != 0 X 0 {
			X--;
			for (int i = 0; i < M; i++) {
				if (X == a[i]) {
					c1++;
				}
			}
		} X-- X for (int i = 0; i < M; i++) {
				if (X == a[i]) {
					c1++;
				}
			} int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
				if (X == a[i]) {
					c1++;
				}
			} {
				if (X == a[i]) {
					c1++;
				}
			} if (X == a[i]) {
					c1++;
				} X == a[i] X a[i] a i {
					c1++;
				} c1++ c1 X = n X n while(X != N) {
			X++;
			for (int i = 0; i < M; i++) {
				if (X == a[i]) {
					c2++;
				}
			}
		} X != N X N {
			X++;
			for (int i = 0; i < M; i++) {
				if (X == a[i]) {
					c2++;
				}
			}
		} X++ X for (int i = 0; i < M; i++) {
				if (X == a[i]) {
					c2++;
				}
			} int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
				if (X == a[i]) {
					c2++;
				}
			} {
				if (X == a[i]) {
					c2++;
				}
			} if (X == a[i]) {
					c2++;
				} X == a[i] X a[i] a i {
					c2++;
				} c2++ c2 if (c1 <= c2) {
			System.out.println(c1);
		} else {
			System.out.println(c2);
		} c1 <= c2 c1 c2 {
			System.out.println(c1);
		} System.out.println(c1) System.out.println System.out System System.out c1 {
			System.out.println(c2);
		} System.out.println(c2) System.out.println System.out System System.out c2 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 a[] = new int[M];
		for (int i = 0; i < M; i++) {
			a[i] = sc.nextInt();
		}

		int c1 = 0;
		int c2 = 0;

		int n = X;
		while(X != 0) {
			X--;
			for (int i = 0; i < M; i++) {
				if (X == a[i]) {
					c1++;
				}
			}
		}

		X = n;
		while(X != N) {
			X++;
			for (int i = 0; i < M; i++) {
				if (X == a[i]) {
					c2++;
				}
			}
		}

		if (c1 <= c2) {
			System.out.println(c1);
		} else {
			System.out.println(c2);
		}

	}

} 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 a[] = new int[M];
		for (int i = 0; i < M; i++) {
			a[i] = sc.nextInt();
		}

		int c1 = 0;
		int c2 = 0;

		int n = X;
		while(X != 0) {
			X--;
			for (int i = 0; i < M; i++) {
				if (X == a[i]) {
					c1++;
				}
			}
		}

		X = n;
		while(X != N) {
			X++;
			for (int i = 0; i < M; i++) {
				if (X == a[i]) {
					c2++;
				}
			}
		}

		if (c1 <= c2) {
			System.out.println(c1);
		} else {
			System.out.println(c2);
		}

	}

} 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 a[] = new int[M];
		for (int i = 0; i < M; i++) {
			a[i] = sc.nextInt();
		}

		int c1 = 0;
		int c2 = 0;

		int n = X;
		while(X != 0) {
			X--;
			for (int i = 0; i < M; i++) {
				if (X == a[i]) {
					c1++;
				}
			}
		}

		X = n;
		while(X != N) {
			X++;
			for (int i = 0; i < M; i++) {
				if (X == a[i]) {
					c2++;
				}
			}
		}

		if (c1 <= c2) {
			System.out.println(c1);
		} else {
			System.out.println(c2);
		}

	}

}