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[] pos = new int[n+1];
      for(int i = 0; i < m; i++)
        pos[sc.nextInt()] = 1;
      int leftCost = 0;
      for(int i = x-1; i > 0; i--)
        leftCost += pos[i];
      int rightCost = 0;
      for(int i = x+1; i < n; i++)
        rightCost += pos[i];

      System.out.println(Math.min(leftCost, rightCost));
  }
} 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[] pos = new int[n+1];
      for(int i = 0; i < m; i++)
        pos[sc.nextInt()] = 1;
      int leftCost = 0;
      for(int i = x-1; i > 0; i--)
        leftCost += pos[i];
      int rightCost = 0;
      for(int i = x+1; i < n; i++)
        rightCost += pos[i];

      System.out.println(Math.min(leftCost, rightCost));
  }
} 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[] pos = new int[n+1];
      for(int i = 0; i < m; i++)
        pos[sc.nextInt()] = 1;
      int leftCost = 0;
      for(int i = x-1; i > 0; i--)
        leftCost += pos[i];
      int rightCost = 0;
      for(int i = x+1; i < n; i++)
        rightCost += pos[i];

      System.out.println(Math.min(leftCost, rightCost));
  } main { 
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int m = sc.nextInt();
      int x = sc.nextInt();

      int[] pos = new int[n+1];
      for(int i = 0; i < m; i++)
        pos[sc.nextInt()] = 1;
      int leftCost = 0;
      for(int i = x-1; i > 0; i--)
        leftCost += pos[i];
      int rightCost = 0;
      for(int i = x+1; i < n; i++)
        rightCost += pos[i];

      System.out.println(Math.min(leftCost, rightCost));
  } 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[] pos = new int[n+1]; pos new int[n+1] n+1 n 1 for(int i = 0; i < m; i++)
        pos[sc.nextInt()] = 1; int i = 0; int i = 0; i 0 i < m i m i++ i++ i pos[sc.nextInt()] = 1; pos[sc.nextInt()] = 1 pos[sc.nextInt()] pos sc.nextInt() sc.nextInt sc 1 int leftCost = 0; leftCost 0 for(int i = x-1; i > 0; i--)
        leftCost += pos[i]; int i = x-1; int i = x-1; i x-1 x 1 i > 0 i 0 i-- i-- i leftCost += pos[i]; leftCost += pos[i] leftCost pos[i] pos i int rightCost = 0; rightCost 0 for(int i = x+1; i < n; i++)
        rightCost += pos[i]; int i = x+1; int i = x+1; i x+1 x 1 i < n i n i++ i++ i rightCost += pos[i]; rightCost += pos[i] rightCost pos[i] pos i System.out.println(Math.min(leftCost, rightCost)) System.out.println System.out System System.out Math.min(leftCost, rightCost) Math.min Math leftCost rightCost 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[] pos = new int[n+1];
      for(int i = 0; i < m; i++)
        pos[sc.nextInt()] = 1;
      int leftCost = 0;
      for(int i = x-1; i > 0; i--)
        leftCost += pos[i];
      int rightCost = 0;
      for(int i = x+1; i < n; i++)
        rightCost += pos[i];

      System.out.println(Math.min(leftCost, rightCost));
  }
} 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[] pos = new int[n+1];
      for(int i = 0; i < m; i++)
        pos[sc.nextInt()] = 1;
      int leftCost = 0;
      for(int i = x-1; i > 0; i--)
        leftCost += pos[i];
      int rightCost = 0;
      for(int i = x+1; i < n; i++)
        rightCost += pos[i];

      System.out.println(Math.min(leftCost, rightCost));
  }
} 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[] pos = new int[n+1];
      for(int i = 0; i < m; i++)
        pos[sc.nextInt()] = 1;
      int leftCost = 0;
      for(int i = x-1; i > 0; i--)
        leftCost += pos[i];
      int rightCost = 0;
      for(int i = x+1; i < n; i++)
        rightCost += pos[i];

      System.out.println(Math.min(leftCost, rightCost));
  }
}