import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		int a[] = new int[m];
		int row[] = new int[n+1];
		int rightsum = 0;
		int leftsum = 0;

		for (int num=0; num < m; num++) {
			a[num] = scan.nextInt();
		}

		for (int i=0; i < m; i++) {
			row[a[i]] = 1;
		}

		int rightnum = n - x;

		for (int j = 0; j <= rightnum; j++) {
			rightsum += row[x + j];
		}

		for (int leftnum = x; leftnum >= 0;leftnum--) {
			leftsum += row[leftnum];
		}

		int sum = (rightsum > leftsum)?leftsum : rightsum;

		System.out.println(sum);

		scan.close();

	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		int a[] = new int[m];
		int row[] = new int[n+1];
		int rightsum = 0;
		int leftsum = 0;

		for (int num=0; num < m; num++) {
			a[num] = scan.nextInt();
		}

		for (int i=0; i < m; i++) {
			row[a[i]] = 1;
		}

		int rightnum = n - x;

		for (int j = 0; j <= rightnum; j++) {
			rightsum += row[x + j];
		}

		for (int leftnum = x; leftnum >= 0;leftnum--) {
			leftsum += row[leftnum];
		}

		int sum = (rightsum > leftsum)?leftsum : rightsum;

		System.out.println(sum);

		scan.close();

	}

} Main public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		int a[] = new int[m];
		int row[] = new int[n+1];
		int rightsum = 0;
		int leftsum = 0;

		for (int num=0; num < m; num++) {
			a[num] = scan.nextInt();
		}

		for (int i=0; i < m; i++) {
			row[a[i]] = 1;
		}

		int rightnum = n - x;

		for (int j = 0; j <= rightnum; j++) {
			rightsum += row[x + j];
		}

		for (int leftnum = x; leftnum >= 0;leftnum--) {
			leftsum += row[leftnum];
		}

		int sum = (rightsum > leftsum)?leftsum : rightsum;

		System.out.println(sum);

		scan.close();

	} main {

		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		int a[] = new int[m];
		int row[] = new int[n+1];
		int rightsum = 0;
		int leftsum = 0;

		for (int num=0; num < m; num++) {
			a[num] = scan.nextInt();
		}

		for (int i=0; i < m; i++) {
			row[a[i]] = 1;
		}

		int rightnum = n - x;

		for (int j = 0; j <= rightnum; j++) {
			rightsum += row[x + j];
		}

		for (int leftnum = x; leftnum >= 0;leftnum--) {
			leftsum += row[leftnum];
		}

		int sum = (rightsum > leftsum)?leftsum : rightsum;

		System.out.println(sum);

		scan.close();

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int m = scan.nextInt(); m scan.nextInt() scan.nextInt scan int x = scan.nextInt(); x scan.nextInt() scan.nextInt scan int a[] = new int[m]; a new int[m] m int row[] = new int[n+1]; row new int[n+1] n+1 n 1 int rightsum = 0; rightsum 0 int leftsum = 0; leftsum 0 for (int num=0; num < m; num++) {
			a[num] = scan.nextInt();
		} int num=0; int num=0; num 0 num < m num m num++ num++ num {
			a[num] = scan.nextInt();
		} {
			a[num] = scan.nextInt();
		} a[num] = scan.nextInt() a[num] a num scan.nextInt() scan.nextInt scan for (int i=0; i < m; i++) {
			row[a[i]] = 1;
		} int i=0; int i=0; i 0 i < m i m i++ i++ i {
			row[a[i]] = 1;
		} {
			row[a[i]] = 1;
		} row[a[i]] = 1 row[a[i]] row a[i] a i 1 int rightnum = n - x; rightnum n - x n x for (int j = 0; j <= rightnum; j++) {
			rightsum += row[x + j];
		} int j = 0; int j = 0; j 0 j <= rightnum j rightnum j++ j++ j {
			rightsum += row[x + j];
		} {
			rightsum += row[x + j];
		} rightsum += row[x + j] rightsum row[x + j] row x + j x j for (int leftnum = x; leftnum >= 0;leftnum--) {
			leftsum += row[leftnum];
		} int leftnum = x; int leftnum = x; leftnum x leftnum >= 0 leftnum 0 leftnum-- leftnum-- leftnum {
			leftsum += row[leftnum];
		} {
			leftsum += row[leftnum];
		} leftsum += row[leftnum] leftsum row[leftnum] row leftnum int sum = (rightsum > leftsum)?leftsum : rightsum; sum (rightsum > leftsum)?leftsum : rightsum (rightsum > leftsum) rightsum leftsum leftsum rightsum System.out.println(sum) System.out.println System.out System System.out sum scan.close() scan.close scan String[] args args public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		int a[] = new int[m];
		int row[] = new int[n+1];
		int rightsum = 0;
		int leftsum = 0;

		for (int num=0; num < m; num++) {
			a[num] = scan.nextInt();
		}

		for (int i=0; i < m; i++) {
			row[a[i]] = 1;
		}

		int rightnum = n - x;

		for (int j = 0; j <= rightnum; j++) {
			rightsum += row[x + j];
		}

		for (int leftnum = x; leftnum >= 0;leftnum--) {
			leftsum += row[leftnum];
		}

		int sum = (rightsum > leftsum)?leftsum : rightsum;

		System.out.println(sum);

		scan.close();

	}

} public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		int a[] = new int[m];
		int row[] = new int[n+1];
		int rightsum = 0;
		int leftsum = 0;

		for (int num=0; num < m; num++) {
			a[num] = scan.nextInt();
		}

		for (int i=0; i < m; i++) {
			row[a[i]] = 1;
		}

		int rightnum = n - x;

		for (int j = 0; j <= rightnum; j++) {
			rightsum += row[x + j];
		}

		for (int leftnum = x; leftnum >= 0;leftnum--) {
			leftsum += row[leftnum];
		}

		int sum = (rightsum > leftsum)?leftsum : rightsum;

		System.out.println(sum);

		scan.close();

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int x = scan.nextInt();
		int a[] = new int[m];
		int row[] = new int[n+1];
		int rightsum = 0;
		int leftsum = 0;

		for (int num=0; num < m; num++) {
			a[num] = scan.nextInt();
		}

		for (int i=0; i < m; i++) {
			row[a[i]] = 1;
		}

		int rightnum = n - x;

		for (int j = 0; j <= rightnum; j++) {
			rightsum += row[x + j];
		}

		for (int leftnum = x; leftnum >= 0;leftnum--) {
			leftsum += row[leftnum];
		}

		int sum = (rightsum > leftsum)?leftsum : rightsum;

		System.out.println(sum);

		scan.close();

	}

}
