import java.util.HashSet;
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();
		HashSet<Integer> A = new HashSet<Integer>();
		for (int i = 0; i < M; i++)
			A.add(sc.nextInt());
		sc.close();

		int ansLeft = 0;
		int ansRight = 0;

		for (int i = X; i >= 0; i--)
			if (A.contains(i))
				ansLeft++;
		for (int i = X; i <= N; i++)
			if (A.contains(i))
				ansRight++;

		System.out.println(Math.min(ansLeft, ansRight));
	}
} import java.util.HashSet; HashSet java.util 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();
		HashSet<Integer> A = new HashSet<Integer>();
		for (int i = 0; i < M; i++)
			A.add(sc.nextInt());
		sc.close();

		int ansLeft = 0;
		int ansRight = 0;

		for (int i = X; i >= 0; i--)
			if (A.contains(i))
				ansLeft++;
		for (int i = X; i <= N; i++)
			if (A.contains(i))
				ansRight++;

		System.out.println(Math.min(ansLeft, ansRight));
	}
} 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();
		HashSet<Integer> A = new HashSet<Integer>();
		for (int i = 0; i < M; i++)
			A.add(sc.nextInt());
		sc.close();

		int ansLeft = 0;
		int ansRight = 0;

		for (int i = X; i >= 0; i--)
			if (A.contains(i))
				ansLeft++;
		for (int i = X; i <= N; i++)
			if (A.contains(i))
				ansRight++;

		System.out.println(Math.min(ansLeft, ansRight));
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		HashSet<Integer> A = new HashSet<Integer>();
		for (int i = 0; i < M; i++)
			A.add(sc.nextInt());
		sc.close();

		int ansLeft = 0;
		int ansRight = 0;

		for (int i = X; i >= 0; i--)
			if (A.contains(i))
				ansLeft++;
		for (int i = X; i <= N; i++)
			if (A.contains(i))
				ansRight++;

		System.out.println(Math.min(ansLeft, ansRight));
	} 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 HashSet<Integer> A = new HashSet<Integer>(); A new HashSet<Integer>() for (int i = 0; i < M; i++)
			A.add(sc.nextInt()); int i = 0; int i = 0; i 0 i < M i M i++ i++ i A.add(sc.nextInt()); A.add(sc.nextInt()) A.add A sc.nextInt() sc.nextInt sc sc.close() sc.close sc int ansLeft = 0; ansLeft 0 int ansRight = 0; ansRight 0 for (int i = X; i >= 0; i--)
			if (A.contains(i))
				ansLeft++; int i = X; int i = X; i X i >= 0 i 0 i-- i-- i if (A.contains(i))
				ansLeft++; if (A.contains(i))
				ansLeft++; A.contains(i) A.contains A i ansLeft++ ansLeft for (int i = X; i <= N; i++)
			if (A.contains(i))
				ansRight++; int i = X; int i = X; i X i <= N i N i++ i++ i if (A.contains(i))
				ansRight++; if (A.contains(i))
				ansRight++; A.contains(i) A.contains A i ansRight++ ansRight System.out.println(Math.min(ansLeft, ansRight)) System.out.println System.out System System.out Math.min(ansLeft, ansRight) Math.min Math ansLeft ansRight 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();
		HashSet<Integer> A = new HashSet<Integer>();
		for (int i = 0; i < M; i++)
			A.add(sc.nextInt());
		sc.close();

		int ansLeft = 0;
		int ansRight = 0;

		for (int i = X; i >= 0; i--)
			if (A.contains(i))
				ansLeft++;
		for (int i = X; i <= N; i++)
			if (A.contains(i))
				ansRight++;

		System.out.println(Math.min(ansLeft, ansRight));
	}
} 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();
		HashSet<Integer> A = new HashSet<Integer>();
		for (int i = 0; i < M; i++)
			A.add(sc.nextInt());
		sc.close();

		int ansLeft = 0;
		int ansRight = 0;

		for (int i = X; i >= 0; i--)
			if (A.contains(i))
				ansLeft++;
		for (int i = X; i <= N; i++)
			if (A.contains(i))
				ansRight++;

		System.out.println(Math.min(ansLeft, ansRight));
	}
} Main
import java.util.HashSet;
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();
		HashSet<Integer> A = new HashSet<Integer>();
		for (int i = 0; i < M; i++)
			A.add(sc.nextInt());
		sc.close();

		int ansLeft = 0;
		int ansRight = 0;

		for (int i = X; i >= 0; i--)
			if (A.contains(i))
				ansLeft++;
		for (int i = X; i <= N; i++)
			if (A.contains(i))
				ansRight++;

		System.out.println(Math.min(ansLeft, ansRight));
	}
}