import java.util.Scanner;

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();

		boolean a[] = new boolean[n];
		for (int i = 1, cnt = 0; cnt < m; cnt++, i++) {
			int an = sc.nextInt();
			while (an != i) i++;
			a[i] = true;
		}

		int cntA = 0;
		int cntB = 0;
		for (int i = 0; i < x; i++) {
			if (a[i]) cntA++;
		}
		for (int i = x + 1; i < n; i++) {
			if (a[i]) cntB++;
		}
		if (cntA > cntB)
			System.out.println(cntB);
		else
			System.out.println(cntA);
	}
} import java.util.Scanner; Scanner java.util 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();

		boolean a[] = new boolean[n];
		for (int i = 1, cnt = 0; cnt < m; cnt++, i++) {
			int an = sc.nextInt();
			while (an != i) i++;
			a[i] = true;
		}

		int cntA = 0;
		int cntB = 0;
		for (int i = 0; i < x; i++) {
			if (a[i]) cntA++;
		}
		for (int i = x + 1; i < n; i++) {
			if (a[i]) cntB++;
		}
		if (cntA > cntB)
			System.out.println(cntB);
		else
			System.out.println(cntA);
	}
} 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();

		boolean a[] = new boolean[n];
		for (int i = 1, cnt = 0; cnt < m; cnt++, i++) {
			int an = sc.nextInt();
			while (an != i) i++;
			a[i] = true;
		}

		int cntA = 0;
		int cntB = 0;
		for (int i = 0; i < x; i++) {
			if (a[i]) cntA++;
		}
		for (int i = x + 1; i < n; i++) {
			if (a[i]) cntB++;
		}
		if (cntA > cntB)
			System.out.println(cntB);
		else
			System.out.println(cntA);
	} main {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();

		boolean a[] = new boolean[n];
		for (int i = 1, cnt = 0; cnt < m; cnt++, i++) {
			int an = sc.nextInt();
			while (an != i) i++;
			a[i] = true;
		}

		int cntA = 0;
		int cntB = 0;
		for (int i = 0; i < x; i++) {
			if (a[i]) cntA++;
		}
		for (int i = x + 1; i < n; i++) {
			if (a[i]) cntB++;
		}
		if (cntA > cntB)
			System.out.println(cntB);
		else
			System.out.println(cntA);
	} 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 boolean a[] = new boolean[n]; a new boolean[n] n for (int i = 1, cnt = 0; cnt < m; cnt++, i++) {
			int an = sc.nextInt();
			while (an != i) i++;
			a[i] = true;
		} int i = 1, cnt = 0; int i = 1 i 1 cnt = 0; cnt 0 cnt < m cnt m cnt++, i++ cnt++ cnt i++ i {
			int an = sc.nextInt();
			while (an != i) i++;
			a[i] = true;
		} {
			int an = sc.nextInt();
			while (an != i) i++;
			a[i] = true;
		} int an = sc.nextInt(); an sc.nextInt() sc.nextInt sc while (an != i) i++; an != i an i i++ i a[i] = true a[i] a i true int cntA = 0; cntA 0 int cntB = 0; cntB 0 for (int i = 0; i < x; i++) {
			if (a[i]) cntA++;
		} int i = 0; int i = 0; i 0 i < x i x i++ i++ i {
			if (a[i]) cntA++;
		} {
			if (a[i]) cntA++;
		} if (a[i]) cntA++; a[i] a i cntA++ cntA for (int i = x + 1; i < n; i++) {
			if (a[i]) cntB++;
		} int i = x + 1; int i = x + 1; i x + 1 x 1 i < n i n i++ i++ i {
			if (a[i]) cntB++;
		} {
			if (a[i]) cntB++;
		} if (a[i]) cntB++; a[i] a i cntB++ cntB if (cntA > cntB)
			System.out.println(cntB);
		else
			System.out.println(cntA); cntA > cntB cntA cntB System.out.println(cntB) System.out.println System.out System System.out cntB System.out.println(cntA) System.out.println System.out System System.out cntA String args[] args
import java.util.Scanner;

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();

		boolean a[] = new boolean[n];
		for (int i = 1, cnt = 0; cnt < m; cnt++, i++) {
			int an = sc.nextInt();
			while (an != i) i++;
			a[i] = true;
		}

		int cntA = 0;
		int cntB = 0;
		for (int i = 0; i < x; i++) {
			if (a[i]) cntA++;
		}
		for (int i = x + 1; i < n; i++) {
			if (a[i]) cntB++;
		}
		if (cntA > cntB)
			System.out.println(cntB);
		else
			System.out.println(cntA);
	}
}
