import 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 + 1];
		
		for (int i = 1; i <= M; i++) {
			A[i] = sc.nextInt();
		}
		
		int nCost = 0;
		for (int i = X + 1; i < N; i++) {
			for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					nCost++;
					break;
				}
			}
		}
		
		int zeroCost = 0;
		for (int i = X - 1; i > 0; i--) {
			for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					zeroCost++;
					break;
				}
			}
		}
		
		System.out.println(Math.min(nCost, zeroCost));
	}
} import java.util.*; util.* java 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 + 1];
		
		for (int i = 1; i <= M; i++) {
			A[i] = sc.nextInt();
		}
		
		int nCost = 0;
		for (int i = X + 1; i < N; i++) {
			for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					nCost++;
					break;
				}
			}
		}
		
		int zeroCost = 0;
		for (int i = X - 1; i > 0; i--) {
			for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					zeroCost++;
					break;
				}
			}
		}
		
		System.out.println(Math.min(nCost, zeroCost));
	}
} 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 + 1];
		
		for (int i = 1; i <= M; i++) {
			A[i] = sc.nextInt();
		}
		
		int nCost = 0;
		for (int i = X + 1; i < N; i++) {
			for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					nCost++;
					break;
				}
			}
		}
		
		int zeroCost = 0;
		for (int i = X - 1; i > 0; i--) {
			for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					zeroCost++;
					break;
				}
			}
		}
		
		System.out.println(Math.min(nCost, zeroCost));
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		int[] A = new int[M + 1];
		
		for (int i = 1; i <= M; i++) {
			A[i] = sc.nextInt();
		}
		
		int nCost = 0;
		for (int i = X + 1; i < N; i++) {
			for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					nCost++;
					break;
				}
			}
		}
		
		int zeroCost = 0;
		for (int i = X - 1; i > 0; i--) {
			for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					zeroCost++;
					break;
				}
			}
		}
		
		System.out.println(Math.min(nCost, zeroCost));
	} 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 + 1]; A new int[M + 1] M + 1 M 1 for (int i = 1; i <= M; i++) {
			A[i] = sc.nextInt();
		} int i = 1; int i = 1; i 1 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 nCost = 0; nCost 0 for (int i = X + 1; i < N; i++) {
			for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					nCost++;
					break;
				}
			}
		} int i = X + 1; int i = X + 1; i X + 1 X 1 i < N i N i++ i++ i {
			for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					nCost++;
					break;
				}
			}
		} {
			for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					nCost++;
					break;
				}
			}
		} for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					nCost++;
					break;
				}
			} int j = 1; int j = 1; j 1 j <= M j M j++ j++ j {
				if (i == A[j]) {
					nCost++;
					break;
				}
			} {
				if (i == A[j]) {
					nCost++;
					break;
				}
			} if (i == A[j]) {
					nCost++;
					break;
				} i == A[j] i A[j] A j {
					nCost++;
					break;
				} nCost++ nCost break; int zeroCost = 0; zeroCost 0 for (int i = X - 1; i > 0; i--) {
			for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					zeroCost++;
					break;
				}
			}
		} int i = X - 1; int i = X - 1; i X - 1 X 1 i > 0 i 0 i-- i-- i {
			for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					zeroCost++;
					break;
				}
			}
		} {
			for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					zeroCost++;
					break;
				}
			}
		} for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					zeroCost++;
					break;
				}
			} int j = 1; int j = 1; j 1 j <= M j M j++ j++ j {
				if (i == A[j]) {
					zeroCost++;
					break;
				}
			} {
				if (i == A[j]) {
					zeroCost++;
					break;
				}
			} if (i == A[j]) {
					zeroCost++;
					break;
				} i == A[j] i A[j] A j {
					zeroCost++;
					break;
				} zeroCost++ zeroCost break; System.out.println(Math.min(nCost, zeroCost)) System.out.println System.out System System.out Math.min(nCost, zeroCost) Math.min Math nCost zeroCost 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 + 1];
		
		for (int i = 1; i <= M; i++) {
			A[i] = sc.nextInt();
		}
		
		int nCost = 0;
		for (int i = X + 1; i < N; i++) {
			for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					nCost++;
					break;
				}
			}
		}
		
		int zeroCost = 0;
		for (int i = X - 1; i > 0; i--) {
			for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					zeroCost++;
					break;
				}
			}
		}
		
		System.out.println(Math.min(nCost, zeroCost));
	}
} 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 + 1];
		
		for (int i = 1; i <= M; i++) {
			A[i] = sc.nextInt();
		}
		
		int nCost = 0;
		for (int i = X + 1; i < N; i++) {
			for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					nCost++;
					break;
				}
			}
		}
		
		int zeroCost = 0;
		for (int i = X - 1; i > 0; i--) {
			for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					zeroCost++;
					break;
				}
			}
		}
		
		System.out.println(Math.min(nCost, zeroCost));
	}
} Main
import 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 + 1];
		
		for (int i = 1; i <= M; i++) {
			A[i] = sc.nextInt();
		}
		
		int nCost = 0;
		for (int i = X + 1; i < N; i++) {
			for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					nCost++;
					break;
				}
			}
		}
		
		int zeroCost = 0;
		for (int i = X - 1; i > 0; i--) {
			for (int j = 1;j <= M; j++) {
				if (i == A[j]) {
					zeroCost++;
					break;
				}
			}
		}
		
		System.out.println(Math.min(nCost, zeroCost));
	}
}
