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[] list = new int[n + 1];
      
        for(int i = 0; i < m; i++) {
          list[sc.nextInt()]++;
        }
      
        int index = x;
        int ans1 = 0;
        while(index != n) {
          ans1 += list[index];
          index++;
        }
      
        index = x;
        int ans2 = 0;
        while(index != 0) {
          ans2 += list[index];
          index--;
        }
    
		// 出力
		System.out.println(Math.min(ans1, ans2));
	}
} 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[] list = new int[n + 1];
      
        for(int i = 0; i < m; i++) {
          list[sc.nextInt()]++;
        }
      
        int index = x;
        int ans1 = 0;
        while(index != n) {
          ans1 += list[index];
          index++;
        }
      
        index = x;
        int ans2 = 0;
        while(index != 0) {
          ans2 += list[index];
          index--;
        }
    
		// 出力
		System.out.println(Math.min(ans1, ans2));
	}
} 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[] list = new int[n + 1];
      
        for(int i = 0; i < m; i++) {
          list[sc.nextInt()]++;
        }
      
        int index = x;
        int ans1 = 0;
        while(index != n) {
          ans1 += list[index];
          index++;
        }
      
        index = x;
        int ans2 = 0;
        while(index != 0) {
          ans2 += list[index];
          index--;
        }
    
		// 出力
		System.out.println(Math.min(ans1, ans2));
	} main {
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
      
        int[] list = new int[n + 1];
      
        for(int i = 0; i < m; i++) {
          list[sc.nextInt()]++;
        }
      
        int index = x;
        int ans1 = 0;
        while(index != n) {
          ans1 += list[index];
          index++;
        }
      
        index = x;
        int ans2 = 0;
        while(index != 0) {
          ans2 += list[index];
          index--;
        }
    
		// 出力
		System.out.println(Math.min(ans1, ans2));
	} 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[] list = new int[n + 1]; list new int[n + 1] n + 1 n 1 for(int i = 0; i < m; i++) {
          list[sc.nextInt()]++;
        } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
          list[sc.nextInt()]++;
        } {
          list[sc.nextInt()]++;
        } list[sc.nextInt()]++ list[sc.nextInt()] list sc.nextInt() sc.nextInt sc int index = x; index x int ans1 = 0; ans1 0 while(index != n) {
          ans1 += list[index];
          index++;
        } index != n index n {
          ans1 += list[index];
          index++;
        } ans1 += list[index] ans1 list[index] list index index++ index index = x index x int ans2 = 0; ans2 0 while(index != 0) {
          ans2 += list[index];
          index--;
        } index != 0 index 0 {
          ans2 += list[index];
          index--;
        } ans2 += list[index] ans2 list[index] list index index-- index System.out.println(Math.min(ans1, ans2)) System.out.println System.out System System.out Math.min(ans1, ans2) Math.min Math ans1 ans2 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[] list = new int[n + 1];
      
        for(int i = 0; i < m; i++) {
          list[sc.nextInt()]++;
        }
      
        int index = x;
        int ans1 = 0;
        while(index != n) {
          ans1 += list[index];
          index++;
        }
      
        index = x;
        int ans2 = 0;
        while(index != 0) {
          ans2 += list[index];
          index--;
        }
    
		// 出力
		System.out.println(Math.min(ans1, ans2));
	}
} 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[] list = new int[n + 1];
      
        for(int i = 0; i < m; i++) {
          list[sc.nextInt()]++;
        }
      
        int index = x;
        int ans1 = 0;
        while(index != n) {
          ans1 += list[index];
          index++;
        }
      
        index = x;
        int ans2 = 0;
        while(index != 0) {
          ans2 += list[index];
          index--;
        }
    
		// 出力
		System.out.println(Math.min(ans1, ans2));
	}
} 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[] list = new int[n + 1];
      
        for(int i = 0; i < m; i++) {
          list[sc.nextInt()]++;
        }
      
        int index = x;
        int ans1 = 0;
        while(index != n) {
          ans1 += list[index];
          index++;
        }
      
        index = x;
        int ans2 = 0;
        while(index != 0) {
          ans2 += list[index];
          index--;
        }
    
		// 出力
		System.out.println(Math.min(ans1, ans2));
	}
}
