import java.util.Scanner;
public class Main{
	static int left(int x,int[] fee) {
		int cnt = 0;
		
		for(int i = x; i >= 0; i--) {
			for(int j = 0; j < fee.length;j++)
			if(i == fee[j]) {
				cnt++;
			}
		}
		return cnt;
	}
	static int right(int x,int n,int[] fee) {
		int cnt = 0;
		
		for(int i = x; i <=n+1; i++) {
			for(int j = 0; j < fee.length;j++)
				if(i == fee[j]) {
					cnt++;
				}
		}
		return cnt;
	}
	
	
	
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt(); //マスの数-1
		int m = stdIn.nextInt(); //料金所の数
		int x = stdIn.nextInt(); //今いるマスの場所
		
		int [] fee = new int[m];
		for(int i = 0; i < m; i++) {
			fee[i] = stdIn.nextInt();
		}
		int a = left(x,fee)<right(x,n,fee)?left(x,fee):right(x,n,fee);
		System.out.println(a);
		
		
		
		
		
	}

} import java.util.Scanner; Scanner java.util public class Main{
	static int left(int x,int[] fee) {
		int cnt = 0;
		
		for(int i = x; i >= 0; i--) {
			for(int j = 0; j < fee.length;j++)
			if(i == fee[j]) {
				cnt++;
			}
		}
		return cnt;
	}
	static int right(int x,int n,int[] fee) {
		int cnt = 0;
		
		for(int i = x; i <=n+1; i++) {
			for(int j = 0; j < fee.length;j++)
				if(i == fee[j]) {
					cnt++;
				}
		}
		return cnt;
	}
	
	
	
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt(); //マスの数-1
		int m = stdIn.nextInt(); //料金所の数
		int x = stdIn.nextInt(); //今いるマスの場所
		
		int [] fee = new int[m];
		for(int i = 0; i < m; i++) {
			fee[i] = stdIn.nextInt();
		}
		int a = left(x,fee)<right(x,n,fee)?left(x,fee):right(x,n,fee);
		System.out.println(a);
		
		
		
		
		
	}

} Main static int left(int x,int[] fee) {
		int cnt = 0;
		
		for(int i = x; i >= 0; i--) {
			for(int j = 0; j < fee.length;j++)
			if(i == fee[j]) {
				cnt++;
			}
		}
		return cnt;
	} left {
		int cnt = 0;
		
		for(int i = x; i >= 0; i--) {
			for(int j = 0; j < fee.length;j++)
			if(i == fee[j]) {
				cnt++;
			}
		}
		return cnt;
	} int cnt = 0; cnt 0 for(int i = x; i >= 0; i--) {
			for(int j = 0; j < fee.length;j++)
			if(i == fee[j]) {
				cnt++;
			}
		} int i = x; int i = x; i x i >= 0 i 0 i-- i-- i {
			for(int j = 0; j < fee.length;j++)
			if(i == fee[j]) {
				cnt++;
			}
		} {
			for(int j = 0; j < fee.length;j++)
			if(i == fee[j]) {
				cnt++;
			}
		} for(int j = 0; j < fee.length;j++)
			if(i == fee[j]) {
				cnt++;
			} int j = 0; int j = 0; j 0 j < fee.length j fee.length fee fee.length j++ j++ j if(i == fee[j]) {
				cnt++;
			} if(i == fee[j]) {
				cnt++;
			} i == fee[j] i fee[j] fee j {
				cnt++;
			} cnt++ cnt return cnt; cnt int x x int[] fee fee static int right(int x,int n,int[] fee) {
		int cnt = 0;
		
		for(int i = x; i <=n+1; i++) {
			for(int j = 0; j < fee.length;j++)
				if(i == fee[j]) {
					cnt++;
				}
		}
		return cnt;
	} right {
		int cnt = 0;
		
		for(int i = x; i <=n+1; i++) {
			for(int j = 0; j < fee.length;j++)
				if(i == fee[j]) {
					cnt++;
				}
		}
		return cnt;
	} int cnt = 0; cnt 0 for(int i = x; i <=n+1; i++) {
			for(int j = 0; j < fee.length;j++)
				if(i == fee[j]) {
					cnt++;
				}
		} int i = x; int i = x; i x i <=n+1 i n+1 n 1 i++ i++ i {
			for(int j = 0; j < fee.length;j++)
				if(i == fee[j]) {
					cnt++;
				}
		} {
			for(int j = 0; j < fee.length;j++)
				if(i == fee[j]) {
					cnt++;
				}
		} for(int j = 0; j < fee.length;j++)
				if(i == fee[j]) {
					cnt++;
				} int j = 0; int j = 0; j 0 j < fee.length j fee.length fee fee.length j++ j++ j if(i == fee[j]) {
					cnt++;
				} if(i == fee[j]) {
					cnt++;
				} i == fee[j] i fee[j] fee j {
					cnt++;
				} cnt++ cnt return cnt; cnt int x x int n n int[] fee fee public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt(); //マスの数-1
		int m = stdIn.nextInt(); //料金所の数
		int x = stdIn.nextInt(); //今いるマスの場所
		
		int [] fee = new int[m];
		for(int i = 0; i < m; i++) {
			fee[i] = stdIn.nextInt();
		}
		int a = left(x,fee)<right(x,n,fee)?left(x,fee):right(x,n,fee);
		System.out.println(a);
		
		
		
		
		
	} main {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt(); //マスの数-1
		int m = stdIn.nextInt(); //料金所の数
		int x = stdIn.nextInt(); //今いるマスの場所
		
		int [] fee = new int[m];
		for(int i = 0; i < m; i++) {
			fee[i] = stdIn.nextInt();
		}
		int a = left(x,fee)<right(x,n,fee)?left(x,fee):right(x,n,fee);
		System.out.println(a);
		
		
		
		
		
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int n = stdIn.nextInt(); n stdIn.nextInt() stdIn.nextInt stdIn int m = stdIn.nextInt(); m stdIn.nextInt() stdIn.nextInt stdIn int x = stdIn.nextInt(); x stdIn.nextInt() stdIn.nextInt stdIn int [] fee = new int[m]; fee new int[m] m for(int i = 0; i < m; i++) {
			fee[i] = stdIn.nextInt();
		} int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
			fee[i] = stdIn.nextInt();
		} {
			fee[i] = stdIn.nextInt();
		} fee[i] = stdIn.nextInt() fee[i] fee i stdIn.nextInt() stdIn.nextInt stdIn int a = left(x,fee)<right(x,n,fee)?left(x,fee):right(x,n,fee); a left(x,fee)<right(x,n,fee)?left(x,fee):right(x,n,fee) left(x,fee)<right(x,n,fee) left(x,fee) left x fee right(x,n,fee) right x n fee left(x,fee) left x fee right(x,n,fee) right x n fee System.out.println(a) System.out.println System.out System System.out a String[] args args public class Main{
	static int left(int x,int[] fee) {
		int cnt = 0;
		
		for(int i = x; i >= 0; i--) {
			for(int j = 0; j < fee.length;j++)
			if(i == fee[j]) {
				cnt++;
			}
		}
		return cnt;
	}
	static int right(int x,int n,int[] fee) {
		int cnt = 0;
		
		for(int i = x; i <=n+1; i++) {
			for(int j = 0; j < fee.length;j++)
				if(i == fee[j]) {
					cnt++;
				}
		}
		return cnt;
	}
	
	
	
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt(); //マスの数-1
		int m = stdIn.nextInt(); //料金所の数
		int x = stdIn.nextInt(); //今いるマスの場所
		
		int [] fee = new int[m];
		for(int i = 0; i < m; i++) {
			fee[i] = stdIn.nextInt();
		}
		int a = left(x,fee)<right(x,n,fee)?left(x,fee):right(x,n,fee);
		System.out.println(a);
		
		
		
		
		
	}

} public class Main{
	static int left(int x,int[] fee) {
		int cnt = 0;
		
		for(int i = x; i >= 0; i--) {
			for(int j = 0; j < fee.length;j++)
			if(i == fee[j]) {
				cnt++;
			}
		}
		return cnt;
	}
	static int right(int x,int n,int[] fee) {
		int cnt = 0;
		
		for(int i = x; i <=n+1; i++) {
			for(int j = 0; j < fee.length;j++)
				if(i == fee[j]) {
					cnt++;
				}
		}
		return cnt;
	}
	
	
	
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt(); //マスの数-1
		int m = stdIn.nextInt(); //料金所の数
		int x = stdIn.nextInt(); //今いるマスの場所
		
		int [] fee = new int[m];
		for(int i = 0; i < m; i++) {
			fee[i] = stdIn.nextInt();
		}
		int a = left(x,fee)<right(x,n,fee)?left(x,fee):right(x,n,fee);
		System.out.println(a);
		
		
		
		
		
	}

} Main
import java.util.Scanner;
public class Main{
	static int left(int x,int[] fee) {
		int cnt = 0;
		
		for(int i = x; i >= 0; i--) {
			for(int j = 0; j < fee.length;j++)
			if(i == fee[j]) {
				cnt++;
			}
		}
		return cnt;
	}
	static int right(int x,int n,int[] fee) {
		int cnt = 0;
		
		for(int i = x; i <=n+1; i++) {
			for(int j = 0; j < fee.length;j++)
				if(i == fee[j]) {
					cnt++;
				}
		}
		return cnt;
	}
	
	
	
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt(); //マスの数-1
		int m = stdIn.nextInt(); //料金所の数
		int x = stdIn.nextInt(); //今いるマスの場所
		
		int [] fee = new int[m];
		for(int i = 0; i < m; i++) {
			fee[i] = stdIn.nextInt();
		}
		int a = left(x,fee)<right(x,n,fee)?left(x,fee):right(x,n,fee);
		System.out.println(a);
		
		
		
		
		
	}

}
