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[] a = new int[n];

    for (int i = 0; i < m; i++) {
      a[sc.nextInt()] = 1;
    }

    int c1 = 0;
    int c2 = 0;

    for (int i = x; i < n; i++) {
      if (a[i] == 1) {
        c1++;
      }
    }

    for (int i = x; i > 0; i--) {
      if (a[i] == 1) {
        c2++;
      }
    }

    System.out.println(Math.min(c1,c2));
  }

} 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[] a = new int[n];

    for (int i = 0; i < m; i++) {
      a[sc.nextInt()] = 1;
    }

    int c1 = 0;
    int c2 = 0;

    for (int i = x; i < n; i++) {
      if (a[i] == 1) {
        c1++;
      }
    }

    for (int i = x; i > 0; i--) {
      if (a[i] == 1) {
        c2++;
      }
    }

    System.out.println(Math.min(c1,c2));
  }

} 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[] a = new int[n];

    for (int i = 0; i < m; i++) {
      a[sc.nextInt()] = 1;
    }

    int c1 = 0;
    int c2 = 0;

    for (int i = x; i < n; i++) {
      if (a[i] == 1) {
        c1++;
      }
    }

    for (int i = x; i > 0; i--) {
      if (a[i] == 1) {
        c2++;
      }
    }

    System.out.println(Math.min(c1,c2));
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int x = sc.nextInt();
    int[] a = new int[n];

    for (int i = 0; i < m; i++) {
      a[sc.nextInt()] = 1;
    }

    int c1 = 0;
    int c2 = 0;

    for (int i = x; i < n; i++) {
      if (a[i] == 1) {
        c1++;
      }
    }

    for (int i = x; i > 0; i--) {
      if (a[i] == 1) {
        c2++;
      }
    }

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

    for (int i = 0; i < m; i++) {
      a[sc.nextInt()] = 1;
    }

    int c1 = 0;
    int c2 = 0;

    for (int i = x; i < n; i++) {
      if (a[i] == 1) {
        c1++;
      }
    }

    for (int i = x; i > 0; i--) {
      if (a[i] == 1) {
        c2++;
      }
    }

    System.out.println(Math.min(c1,c2));
  }

} 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[] a = new int[n];

    for (int i = 0; i < m; i++) {
      a[sc.nextInt()] = 1;
    }

    int c1 = 0;
    int c2 = 0;

    for (int i = x; i < n; i++) {
      if (a[i] == 1) {
        c1++;
      }
    }

    for (int i = x; i > 0; i--) {
      if (a[i] == 1) {
        c2++;
      }
    }

    System.out.println(Math.min(c1,c2));
  }

} 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[] a = new int[n];

    for (int i = 0; i < m; i++) {
      a[sc.nextInt()] = 1;
    }

    int c1 = 0;
    int c2 = 0;

    for (int i = x; i < n; i++) {
      if (a[i] == 1) {
        c1++;
      }
    }

    for (int i = x; i > 0; i--) {
      if (a[i] == 1) {
        c2++;
      }
    }

    System.out.println(Math.min(c1,c2));
  }

}
