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 move = 0;
		int fee = 0;
		//料金所の位置と料金設定
		int a[] = new int[n+1];
		for(int i = 0;i < m;i++) {
			move = sc.nextInt();
			a[move] = 1;
		}
		//前後別の試行
		for(int i = x;i < n;i++) {
			fee = fee + a[i];
		}
		//一時置き換え
		move = fee;
		fee = 0;
		for(int i = x;i > 0;i--) {
			fee = fee + a[i];
		}
		//どちらが少ないかを判定
		if(move > fee) {
			move = fee;
		}
		//出力
		System.out.println(move);
		sc.close();
	}
} 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 move = 0;
		int fee = 0;
		//料金所の位置と料金設定
		int a[] = new int[n+1];
		for(int i = 0;i < m;i++) {
			move = sc.nextInt();
			a[move] = 1;
		}
		//前後別の試行
		for(int i = x;i < n;i++) {
			fee = fee + a[i];
		}
		//一時置き換え
		move = fee;
		fee = 0;
		for(int i = x;i > 0;i--) {
			fee = fee + a[i];
		}
		//どちらが少ないかを判定
		if(move > fee) {
			move = fee;
		}
		//出力
		System.out.println(move);
		sc.close();
	}
} 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 move = 0;
		int fee = 0;
		//料金所の位置と料金設定
		int a[] = new int[n+1];
		for(int i = 0;i < m;i++) {
			move = sc.nextInt();
			a[move] = 1;
		}
		//前後別の試行
		for(int i = x;i < n;i++) {
			fee = fee + a[i];
		}
		//一時置き換え
		move = fee;
		fee = 0;
		for(int i = x;i > 0;i--) {
			fee = fee + a[i];
		}
		//どちらが少ないかを判定
		if(move > fee) {
			move = fee;
		}
		//出力
		System.out.println(move);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		//全体の長さを入力
		int n = sc.nextInt();
		//料金所の数を設定
		int m = sc.nextInt();
		//初期位置を設定
		int x = sc.nextInt();
		//料金・通過のカウント
		int move = 0;
		int fee = 0;
		//料金所の位置と料金設定
		int a[] = new int[n+1];
		for(int i = 0;i < m;i++) {
			move = sc.nextInt();
			a[move] = 1;
		}
		//前後別の試行
		for(int i = x;i < n;i++) {
			fee = fee + a[i];
		}
		//一時置き換え
		move = fee;
		fee = 0;
		for(int i = x;i > 0;i--) {
			fee = fee + a[i];
		}
		//どちらが少ないかを判定
		if(move > fee) {
			move = fee;
		}
		//出力
		System.out.println(move);
		sc.close();
	} 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 move = 0; move 0 int fee = 0; fee 0 int a[] = new int[n+1]; a new int[n+1] n+1 n 1 for(int i = 0;i < m;i++) {
			move = sc.nextInt();
			a[move] = 1;
		} int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
			move = sc.nextInt();
			a[move] = 1;
		} {
			move = sc.nextInt();
			a[move] = 1;
		} move = sc.nextInt() move sc.nextInt() sc.nextInt sc a[move] = 1 a[move] a move 1 for(int i = x;i < n;i++) {
			fee = fee + a[i];
		} int i = x; int i = x; i x i < n i n i++ i++ i {
			fee = fee + a[i];
		} {
			fee = fee + a[i];
		} fee = fee + a[i] fee fee + a[i] fee a[i] a i move = fee move fee fee = 0 fee 0 for(int i = x;i > 0;i--) {
			fee = fee + a[i];
		} int i = x; int i = x; i x i > 0 i 0 i-- i-- i {
			fee = fee + a[i];
		} {
			fee = fee + a[i];
		} fee = fee + a[i] fee fee + a[i] fee a[i] a i if(move > fee) {
			move = fee;
		} move > fee move fee {
			move = fee;
		} move = fee move fee System.out.println(move) System.out.println System.out System System.out move sc.close() sc.close sc 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 move = 0;
		int fee = 0;
		//料金所の位置と料金設定
		int a[] = new int[n+1];
		for(int i = 0;i < m;i++) {
			move = sc.nextInt();
			a[move] = 1;
		}
		//前後別の試行
		for(int i = x;i < n;i++) {
			fee = fee + a[i];
		}
		//一時置き換え
		move = fee;
		fee = 0;
		for(int i = x;i > 0;i--) {
			fee = fee + a[i];
		}
		//どちらが少ないかを判定
		if(move > fee) {
			move = fee;
		}
		//出力
		System.out.println(move);
		sc.close();
	}
} 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 move = 0;
		int fee = 0;
		//料金所の位置と料金設定
		int a[] = new int[n+1];
		for(int i = 0;i < m;i++) {
			move = sc.nextInt();
			a[move] = 1;
		}
		//前後別の試行
		for(int i = x;i < n;i++) {
			fee = fee + a[i];
		}
		//一時置き換え
		move = fee;
		fee = 0;
		for(int i = x;i > 0;i--) {
			fee = fee + a[i];
		}
		//どちらが少ないかを判定
		if(move > fee) {
			move = fee;
		}
		//出力
		System.out.println(move);
		sc.close();
	}
} 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 move = 0;
		int fee = 0;
		//料金所の位置と料金設定
		int a[] = new int[n+1];
		for(int i = 0;i < m;i++) {
			move = sc.nextInt();
			a[move] = 1;
		}
		//前後別の試行
		for(int i = x;i < n;i++) {
			fee = fee + a[i];
		}
		//一時置き換え
		move = fee;
		fee = 0;
		for(int i = x;i > 0;i--) {
			fee = fee + a[i];
		}
		//どちらが少ないかを判定
		if(move > fee) {
			move = fee;
		}
		//出力
		System.out.println(move);
		sc.close();
	}
}