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[] place = new int[100001];
    for (int i = 0; i < M; i++) {
      int tmp = sc.nextInt();
      place[tmp]++;
    }
    int count1 = 0;
    for (int i = 1; i < X; i++) {
      if (place[i] > 0) {
        count1++;
      }
    }
    int count2 = 0;
    for (int i = X + 1; i < N; i++) {
      if (place[i] > 0) {
        count2++;
      }
    }
    System.out.println(Integer.min(count1, count2));
  }
} 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[] place = new int[100001];
    for (int i = 0; i < M; i++) {
      int tmp = sc.nextInt();
      place[tmp]++;
    }
    int count1 = 0;
    for (int i = 1; i < X; i++) {
      if (place[i] > 0) {
        count1++;
      }
    }
    int count2 = 0;
    for (int i = X + 1; i < N; i++) {
      if (place[i] > 0) {
        count2++;
      }
    }
    System.out.println(Integer.min(count1, count2));
  }
} 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[] place = new int[100001];
    for (int i = 0; i < M; i++) {
      int tmp = sc.nextInt();
      place[tmp]++;
    }
    int count1 = 0;
    for (int i = 1; i < X; i++) {
      if (place[i] > 0) {
        count1++;
      }
    }
    int count2 = 0;
    for (int i = X + 1; i < N; i++) {
      if (place[i] > 0) {
        count2++;
      }
    }
    System.out.println(Integer.min(count1, count2));
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int X = sc.nextInt();
    int[] place = new int[100001];
    for (int i = 0; i < M; i++) {
      int tmp = sc.nextInt();
      place[tmp]++;
    }
    int count1 = 0;
    for (int i = 1; i < X; i++) {
      if (place[i] > 0) {
        count1++;
      }
    }
    int count2 = 0;
    for (int i = X + 1; i < N; i++) {
      if (place[i] > 0) {
        count2++;
      }
    }
    System.out.println(Integer.min(count1, count2));
  } 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[] place = new int[100001]; place new int[100001] 100001 for (int i = 0; i < M; i++) {
      int tmp = sc.nextInt();
      place[tmp]++;
    } int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
      int tmp = sc.nextInt();
      place[tmp]++;
    } {
      int tmp = sc.nextInt();
      place[tmp]++;
    } int tmp = sc.nextInt(); tmp sc.nextInt() sc.nextInt sc place[tmp]++ place[tmp] place tmp int count1 = 0; count1 0 for (int i = 1; i < X; i++) {
      if (place[i] > 0) {
        count1++;
      }
    } int i = 1; int i = 1; i 1 i < X i X i++ i++ i {
      if (place[i] > 0) {
        count1++;
      }
    } {
      if (place[i] > 0) {
        count1++;
      }
    } if (place[i] > 0) {
        count1++;
      } place[i] > 0 place[i] place i 0 {
        count1++;
      } count1++ count1 int count2 = 0; count2 0 for (int i = X + 1; i < N; i++) {
      if (place[i] > 0) {
        count2++;
      }
    } int i = X + 1; int i = X + 1; i X + 1 X 1 i < N i N i++ i++ i {
      if (place[i] > 0) {
        count2++;
      }
    } {
      if (place[i] > 0) {
        count2++;
      }
    } if (place[i] > 0) {
        count2++;
      } place[i] > 0 place[i] place i 0 {
        count2++;
      } count2++ count2 System.out.println(Integer.min(count1, count2)) System.out.println System.out System System.out Integer.min(count1, count2) Integer.min Integer count1 count2 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[] place = new int[100001];
    for (int i = 0; i < M; i++) {
      int tmp = sc.nextInt();
      place[tmp]++;
    }
    int count1 = 0;
    for (int i = 1; i < X; i++) {
      if (place[i] > 0) {
        count1++;
      }
    }
    int count2 = 0;
    for (int i = X + 1; i < N; i++) {
      if (place[i] > 0) {
        count2++;
      }
    }
    System.out.println(Integer.min(count1, count2));
  }
} 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[] place = new int[100001];
    for (int i = 0; i < M; i++) {
      int tmp = sc.nextInt();
      place[tmp]++;
    }
    int count1 = 0;
    for (int i = 1; i < X; i++) {
      if (place[i] > 0) {
        count1++;
      }
    }
    int count2 = 0;
    for (int i = X + 1; i < N; i++) {
      if (place[i] > 0) {
        count2++;
      }
    }
    System.out.println(Integer.min(count1, count2));
  }
} 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[] place = new int[100001];
    for (int i = 0; i < M; i++) {
      int tmp = sc.nextInt();
      place[tmp]++;
    }
    int count1 = 0;
    for (int i = 1; i < X; i++) {
      if (place[i] > 0) {
        count1++;
      }
    }
    int count2 = 0;
    for (int i = X + 1; i < N; i++) {
      if (place[i] > 0) {
        count2++;
      }
    }
    System.out.println(Integer.min(count1, count2));
  }
}