import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		// 文字列の入力
		String s1 = sc.nextLine();

		String[] sr1 = s1.split(" ");
		
		int n = Integer.parseInt(sr1[0]);
		int m = Integer.parseInt(sr1[1]);
		int x = Integer.parseInt(sr1[2]);

		String s2 = sc.nextLine();

		String[] sr2 = s2.split(" ");

		int count1 = 0;
		for(int i = x; i<=n; i++) {
			for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count1++;
			}
		}

		int count2 = 0;
		for(int i = x; i>=0; i--) {
			for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count2++;
			}
		}

		if(count1 <= count2) {
			// 出力
			System.out.println(count1);
		} else {
			// 出力
			System.out.println(count2);
		}
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		// 文字列の入力
		String s1 = sc.nextLine();

		String[] sr1 = s1.split(" ");
		
		int n = Integer.parseInt(sr1[0]);
		int m = Integer.parseInt(sr1[1]);
		int x = Integer.parseInt(sr1[2]);

		String s2 = sc.nextLine();

		String[] sr2 = s2.split(" ");

		int count1 = 0;
		for(int i = x; i<=n; i++) {
			for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count1++;
			}
		}

		int count2 = 0;
		for(int i = x; i>=0; i--) {
			for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count2++;
			}
		}

		if(count1 <= count2) {
			// 出力
			System.out.println(count1);
		} else {
			// 出力
			System.out.println(count2);
		}
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		// 文字列の入力
		String s1 = sc.nextLine();

		String[] sr1 = s1.split(" ");
		
		int n = Integer.parseInt(sr1[0]);
		int m = Integer.parseInt(sr1[1]);
		int x = Integer.parseInt(sr1[2]);

		String s2 = sc.nextLine();

		String[] sr2 = s2.split(" ");

		int count1 = 0;
		for(int i = x; i<=n; i++) {
			for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count1++;
			}
		}

		int count2 = 0;
		for(int i = x; i>=0; i--) {
			for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count2++;
			}
		}

		if(count1 <= count2) {
			// 出力
			System.out.println(count1);
		} else {
			// 出力
			System.out.println(count2);
		}
	} main {
		Scanner sc = new Scanner(System.in);

		// 文字列の入力
		String s1 = sc.nextLine();

		String[] sr1 = s1.split(" ");
		
		int n = Integer.parseInt(sr1[0]);
		int m = Integer.parseInt(sr1[1]);
		int x = Integer.parseInt(sr1[2]);

		String s2 = sc.nextLine();

		String[] sr2 = s2.split(" ");

		int count1 = 0;
		for(int i = x; i<=n; i++) {
			for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count1++;
			}
		}

		int count2 = 0;
		for(int i = x; i>=0; i--) {
			for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count2++;
			}
		}

		if(count1 <= count2) {
			// 出力
			System.out.println(count1);
		} else {
			// 出力
			System.out.println(count2);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s1 = sc.nextLine(); s1 sc.nextLine() sc.nextLine sc String[] sr1 = s1.split(" "); sr1 s1.split(" ") s1.split s1 " " int n = Integer.parseInt(sr1[0]); n Integer.parseInt(sr1[0]) Integer.parseInt Integer sr1[0] sr1 0 int m = Integer.parseInt(sr1[1]); m Integer.parseInt(sr1[1]) Integer.parseInt Integer sr1[1] sr1 1 int x = Integer.parseInt(sr1[2]); x Integer.parseInt(sr1[2]) Integer.parseInt Integer sr1[2] sr1 2 String s2 = sc.nextLine(); s2 sc.nextLine() sc.nextLine sc String[] sr2 = s2.split(" "); sr2 s2.split(" ") s2.split s2 " " int count1 = 0; count1 0 for(int i = x; i<=n; i++) {
			for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count1++;
			}
		} int i = x; int i = x; i x i<=n i n i++ i++ i {
			for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count1++;
			}
		} {
			for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count1++;
			}
		} for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count1++;
			} int j = 0; int j = 0; j 0 j<m j m j++ j++ j {
				if(i == Integer.parseInt(sr2[j])) count1++;
			} {
				if(i == Integer.parseInt(sr2[j])) count1++;
			} if(i == Integer.parseInt(sr2[j])) count1++; i == Integer.parseInt(sr2[j]) i Integer.parseInt(sr2[j]) Integer.parseInt Integer sr2[j] sr2 j count1++ count1 int count2 = 0; count2 0 for(int i = x; i>=0; i--) {
			for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count2++;
			}
		} int i = x; int i = x; i x i>=0 i 0 i-- i-- i {
			for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count2++;
			}
		} {
			for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count2++;
			}
		} for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count2++;
			} int j = 0; int j = 0; j 0 j<m j m j++ j++ j {
				if(i == Integer.parseInt(sr2[j])) count2++;
			} {
				if(i == Integer.parseInt(sr2[j])) count2++;
			} if(i == Integer.parseInt(sr2[j])) count2++; i == Integer.parseInt(sr2[j]) i Integer.parseInt(sr2[j]) Integer.parseInt Integer sr2[j] sr2 j count2++ count2 if(count1 <= count2) {
			// 出力
			System.out.println(count1);
		} else {
			// 出力
			System.out.println(count2);
		} count1 <= count2 count1 count2 {
			// 出力
			System.out.println(count1);
		} System.out.println(count1) System.out.println System.out System System.out count1 {
			// 出力
			System.out.println(count2);
		} System.out.println(count2) System.out.println System.out System System.out count2 String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		// 文字列の入力
		String s1 = sc.nextLine();

		String[] sr1 = s1.split(" ");
		
		int n = Integer.parseInt(sr1[0]);
		int m = Integer.parseInt(sr1[1]);
		int x = Integer.parseInt(sr1[2]);

		String s2 = sc.nextLine();

		String[] sr2 = s2.split(" ");

		int count1 = 0;
		for(int i = x; i<=n; i++) {
			for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count1++;
			}
		}

		int count2 = 0;
		for(int i = x; i>=0; i--) {
			for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count2++;
			}
		}

		if(count1 <= count2) {
			// 出力
			System.out.println(count1);
		} else {
			// 出力
			System.out.println(count2);
		}
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		// 文字列の入力
		String s1 = sc.nextLine();

		String[] sr1 = s1.split(" ");
		
		int n = Integer.parseInt(sr1[0]);
		int m = Integer.parseInt(sr1[1]);
		int x = Integer.parseInt(sr1[2]);

		String s2 = sc.nextLine();

		String[] sr2 = s2.split(" ");

		int count1 = 0;
		for(int i = x; i<=n; i++) {
			for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count1++;
			}
		}

		int count2 = 0;
		for(int i = x; i>=0; i--) {
			for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count2++;
			}
		}

		if(count1 <= count2) {
			// 出力
			System.out.println(count1);
		} else {
			// 出力
			System.out.println(count2);
		}
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		// 文字列の入力
		String s1 = sc.nextLine();

		String[] sr1 = s1.split(" ");
		
		int n = Integer.parseInt(sr1[0]);
		int m = Integer.parseInt(sr1[1]);
		int x = Integer.parseInt(sr1[2]);

		String s2 = sc.nextLine();

		String[] sr2 = s2.split(" ");

		int count1 = 0;
		for(int i = x; i<=n; i++) {
			for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count1++;
			}
		}

		int count2 = 0;
		for(int i = x; i>=0; i--) {
			for(int j = 0; j<m; j++) {
				if(i == Integer.parseInt(sr2[j])) count2++;
			}
		}

		if(count1 <= count2) {
			// 出力
			System.out.println(count1);
		} else {
			// 出力
			System.out.println(count2);
		}
	}
}