import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		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();
		}
		sc.close();
		// N方面へ
		int costN = 0;
		for(int i = X + 1;i <= N;i++) {
			for(int k = 0;k < M;k++) {
				if(A[k] == i) costN++;
			}
		}
		// 0方面へ
		int costZ = 0;
		for(int i = X - 1;i >= 0;i--) {
			for(int k = 0;k < M;k++) {
				if(A[k] == i) costZ++;
			}
		}
		System.out.println(Math.min(costN,costZ));
	}

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

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		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();
		}
		sc.close();
		// N方面へ
		int costN = 0;
		for(int i = X + 1;i <= N;i++) {
			for(int k = 0;k < M;k++) {
				if(A[k] == i) costN++;
			}
		}
		// 0方面へ
		int costZ = 0;
		for(int i = X - 1;i >= 0;i--) {
			for(int k = 0;k < M;k++) {
				if(A[k] == i) costZ++;
			}
		}
		System.out.println(Math.min(costN,costZ));
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		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();
		}
		sc.close();
		// N方面へ
		int costN = 0;
		for(int i = X + 1;i <= N;i++) {
			for(int k = 0;k < M;k++) {
				if(A[k] == i) costN++;
			}
		}
		// 0方面へ
		int costZ = 0;
		for(int i = X - 1;i >= 0;i--) {
			for(int k = 0;k < M;k++) {
				if(A[k] == i) costZ++;
			}
		}
		System.out.println(Math.min(costN,costZ));
	} main {
		// TODO Auto-generated method stub
		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();
		}
		sc.close();
		// N方面へ
		int costN = 0;
		for(int i = X + 1;i <= N;i++) {
			for(int k = 0;k < M;k++) {
				if(A[k] == i) costN++;
			}
		}
		// 0方面へ
		int costZ = 0;
		for(int i = X - 1;i >= 0;i--) {
			for(int k = 0;k < M;k++) {
				if(A[k] == i) costZ++;
			}
		}
		System.out.println(Math.min(costN,costZ));
	} 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 sc.close() sc.close sc int costN = 0; costN 0 for(int i = X + 1;i <= N;i++) {
			for(int k = 0;k < M;k++) {
				if(A[k] == i) costN++;
			}
		} int i = X + 1; int i = X + 1; i X + 1 X 1 i <= N i N i++ i++ i {
			for(int k = 0;k < M;k++) {
				if(A[k] == i) costN++;
			}
		} {
			for(int k = 0;k < M;k++) {
				if(A[k] == i) costN++;
			}
		} for(int k = 0;k < M;k++) {
				if(A[k] == i) costN++;
			} int k = 0; int k = 0; k 0 k < M k M k++ k++ k {
				if(A[k] == i) costN++;
			} {
				if(A[k] == i) costN++;
			} if(A[k] == i) costN++; A[k] == i A[k] A k i costN++ costN int costZ = 0; costZ 0 for(int i = X - 1;i >= 0;i--) {
			for(int k = 0;k < M;k++) {
				if(A[k] == i) costZ++;
			}
		} int i = X - 1; int i = X - 1; i X - 1 X 1 i >= 0 i 0 i-- i-- i {
			for(int k = 0;k < M;k++) {
				if(A[k] == i) costZ++;
			}
		} {
			for(int k = 0;k < M;k++) {
				if(A[k] == i) costZ++;
			}
		} for(int k = 0;k < M;k++) {
				if(A[k] == i) costZ++;
			} int k = 0; int k = 0; k 0 k < M k M k++ k++ k {
				if(A[k] == i) costZ++;
			} {
				if(A[k] == i) costZ++;
			} if(A[k] == i) costZ++; A[k] == i A[k] A k i costZ++ costZ System.out.println(Math.min(costN,costZ)) System.out.println System.out System System.out Math.min(costN,costZ) Math.min Math costN costZ String[] args args public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		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();
		}
		sc.close();
		// N方面へ
		int costN = 0;
		for(int i = X + 1;i <= N;i++) {
			for(int k = 0;k < M;k++) {
				if(A[k] == i) costN++;
			}
		}
		// 0方面へ
		int costZ = 0;
		for(int i = X - 1;i >= 0;i--) {
			for(int k = 0;k < M;k++) {
				if(A[k] == i) costZ++;
			}
		}
		System.out.println(Math.min(costN,costZ));
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		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();
		}
		sc.close();
		// N方面へ
		int costN = 0;
		for(int i = X + 1;i <= N;i++) {
			for(int k = 0;k < M;k++) {
				if(A[k] == i) costN++;
			}
		}
		// 0方面へ
		int costZ = 0;
		for(int i = X - 1;i >= 0;i--) {
			for(int k = 0;k < M;k++) {
				if(A[k] == i) costZ++;
			}
		}
		System.out.println(Math.min(costN,costZ));
	}

} Main
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		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();
		}
		sc.close();
		// N方面へ
		int costN = 0;
		for(int i = X + 1;i <= N;i++) {
			for(int k = 0;k < M;k++) {
				if(A[k] == i) costN++;
			}
		}
		// 0方面へ
		int costZ = 0;
		for(int i = X - 1;i >= 0;i--) {
			for(int k = 0;k < M;k++) {
				if(A[k] == i) costZ++;
			}
		}
		System.out.println(Math.min(costN,costZ));
	}

}
